If you have any interest in the novel I wrote in November this definition (which I found online somewhere) says everything:
Deus Ex Machina: Meaning “”a god from a machine,”” originated in Greek drama, in which playwrights sometimes introduced a god to resolve a problem so that a play could end. These intervening gods descended onto the stage by means of a mechanical device. Today, deus ex machina is used to refer to any unlikely, contrived or trick resolution of a plot in any type of fiction. Critics–and readers–generally object to this technique, which is most commonly used by beginning writers.