The awesome thing about science fiction is that anything can happen — including the occasional incredibly convenient miracle. Sometimes circumstances become so desperate and dire in a science fiction tale that even the "reset button" can't fix them — and that's when the "deus ex machina" shows up. The term, meaning "God from a machine," comes from classical theater, where a wheel-and-pulley deity would literally show up to sort everything out. And in science fiction, god literally can come out of a machine. Bow your head before our taxonomy of the most unlikely miracles in scifi history.
I. The Unexpected (But Basic) Weakness.
War Of The Worlds by H.G. Wells. One of the earliest classic science fiction tales has one of the most ridiculous miracles as well. I remember when I read this book as a kid, I threw it across the room when I got to the "and then they all got the flu and died, kthxbai" ending. Even as a kid, I felt totally cheated. And the 2005 Spielberg film jettisoned almost everything about the book — except the ending. Trust Alan Moore to fix the problem by making the deadly disease into biological warfare in his second League of Extraordinary Gentlemen graphic novel.
Signs. Along similar lines, we have the aliens whose one great weakness is water — so they invade a planet that's mostly water. It's just a tad convenient, but we've already ragged on this movie enough.
II. A Human Suddenly Touches The Soul Of The Machine.
Doctor Who, "The Parting Of The Ways." Almost every season of Russell T. Davies' Doctor Who series has ended with some kind of unlikely miracle fix, but the first one was by far the hardest to swallow. The Doctor is facing an army of 100 trillion Daleks, who are also religious fundamentalists (just to make them even scarier) and he's spent the whole episode building a weapon that he won't use because it'll kill everybody, even the nice humans. And then Rose sees some graffiti and figures out that if she looks into the heart of the TARDIS, something totally awesome will happen. Never mind that the last time someone looked into the heart of the TARDIS, she regressed into a baby. But this time, it totally turns Rose into a super-god! But only for about five minutes, just long enough for her to wipe out all the fundy Daleks, and resurrect the hunky Jack — but not the cute Lynda-with-a-Y, because Rose is glad she's dead. Rose is a mean God, sadly. And here's that video:
The Matrix: Revolutions. Is it still a deus ex machina if you call it "The Deus Ex Machina?" Mayyyybe. In the end of the third film, Neo journeys to the "machine city" and makes a deal with the personification of the meachines, which calls itself the Deus Ex Machina. Actually, this bit grows pretty logically out of the rest of the events in the film, so I'm inclined to give it a pass. If you think the Matrix sequels in general make sense, than this bit makes sense, too.
III. The Cavalry Arrives.
The Diamond Age by Neil Stephenson. The world is totally shitfucked, and then John Percival Hackworth creates a multimedia AI book as a "primer" for young ladies. Nell gets a copy of the book, and it teaches her how to become a super-genius ninja mastermind. At the end of the book, just when you think everything is completely screwed, it suddenly turns out someone has pirated and mass-produced the book, and squillions of unwanted Chinese girls have all read it and turned into an army of super-ninjas, aka the Mouse Army. Suddenly, everything's going to be fantastic!
The Chrysalids by John Wyndham. TK and his friends are psychic — which is an illegal mutation in this nasty post-nuclear Newfoundland, which persecutes mutants. It's basically like the X-Men, with less technology and better liquor. Just when all seems hopeless, one of the telepathic mutants manages to reach all the way to New Zealand, which turns out to be a technologically advanced, enlightened society where it's actually cool to be telepathic. The New Zealanders randomly show up and rescue our heroes just in the nick of time. Yay, New Zealand!
IV. God Actually Shows Up.
Babylon 5. Sheridan is killed at the end of the third season, and war is looming and everything seems lost and horrible... until the nice Lorien, who's the first being to have attained sentience in our galaxy and has a great skin-care routine, saves Sheridan by imbuing him with his own life-force... but only after Sheridan confronts his fear of death and has the specially mandated Near-Death Catharsis (TM).
Forever Free by Joe Haldeman. According to BookSlut, Haldeman's The Forever War used time dilation and "the cold immensity of the universe" as a metaphor for the Vietnam War. But in this quasi-sequel, the disruption of the universe's physical laws turns out to be "just the effects of a god messing about with his creation." Also, we discover that a reckless experiment could destroy the entire universe, and then a few pages later we learn that there's a way to make humans totally non-aggressive. "All the problems that are introduced are solved with a wave of the hand," says Evelyn Leeper.
V. It's All A Test
Space: 1999. I've been searching and searching for this episode I saw when I was a kid, where Moonbase Alpha hurtles into a weird void where everything goes strobeadelic and regular characters start dying randomly, and everybody keeps seeing freaky ghosts, and a bunch of their Eagle scoutships crash onto a mossy planet whose atmosphere is pure LSD. And just when Commander Koenig cant stand this trippy-ass shit any longer, it turns out it was all just a godlike entity yanking on the waistband of his poly-blend pajama bottoms, just to see how he'd handle it. And now that he's shown he's not going to put up with this shit, the Moonbase can go on its merry way. (I can't find this episode in any episode guides. Did it exist? Or did I invent it?) I feel as though there are twenty episodes of the original Star Trek that follow this formula, too. But since O.G. Trek is full of godlike entities anyway, it's not as if the gods on Trek come out of nowhere — they come out of the show's limitless supply of gods. It would be surprising if a godlike entity didn't randomly show up.