Deus ex machina is this:
"Captain, we've spent the past 200 pages of this novel trying to escape the evil zombies. We cannot escape this inescapable maze of doom. How will we ever make it?"
"Sergeant, I have no idea. Put your finger on that little red button. We'll self destruct in 10, 9, 8, 7, 6, 5, 4, 3, 2, Wait! What's that alien spaceship doing?"
"Lo and Behold, a greater than us, almost god-like species, never before introduced in the plot of our 200 page novel, has just swooped in to save us, the world, and the universe in the last 10 pages of our story."
Reader: throws novel against the wall, let down by the author.
Deus ex machina. "God from the Machine."
The classics were full of this. Aristotle was the first to say, "Whoa, Nelly". The resolution of the plot must be internal to the plot. It has to come from the progression of the story, not out of left field at the last moment.
This is like the end of The Abyss, where the ending has no real relation to the first 3/4 of the movie and the climax/resolution did not flow from the buildup/conflict. This is beyond a surprise ending, where clues are dropped, but from an entire new concept. Twist endings are great. God-like intervention endings are a disappointment. But, hey, I loved The Abyss, so *shrug* sometimes it works for a portions of the audience, but I have seen this movie completely panned because of the ending.
The end of The Abyss seems a direct homage to 2001 A Space Odyssey, which has a similar deus ex machina, in the form of the monolith, in itself a "god machine".
It's debatable whether deus ex machina works in a story. If it does, perhaps it's due to the odyssey (nod to The Odyssey intended). The allusion to the Greek-like journey lends itself to such a grandiose end. Is this the author's laziness, or that idea that humans can't save themselves, but some sort of divine intervention (or other-worldly) is necessary to help humans rise above the depths.
For more about deus ex machina, there's a little info on Wikipedia.
As an aspiring author working on a manuscript where the ending is a surprise to the hero and heroine (H/h), I took great pains to create a timeline that worked for the reader while leaving the H/h in the dark. Part of that was to add an additional POV besides the H/h to avoid the deus ex machina. It may be more work, but the readers will get more out of the story.
And they hopefully won't throw the book against the wall.