There is no phrase (that I know of, obviously) that is an exact opposite to the concept of Deus Ex Machina, which is very specific. It doesn't just describe resolution out of nowhere, it describes resolution in the heart of a situation that looks so utterly bleak that there really can be no resolution. I believe Simchona's answer, "sudden tragedy" is the best you will get out of our current language. However it is not an exact opposite since sudden tragedy is free to strike in good, bad, or neutral times, not just good ones as one would expect from the opposite of this phrase.
Since "Deus Ex Machine" literally means "God out of the machine." You might consider using your own psuedo-latin phrase, for example:
"Nex Ex Machina" (Death out of the machine)
"Diaboli Ex Machina" (Satan out of the machine.)
(PS: I know nothing about Latin so I am 100% guessing that I can just grab 'deus' and replace it with other nouns to keep the same meaning!)