Deus ex machina

Deus ex machina (sometimes spelled "Deux ex machina" or) is a plot device in which a character, force, or thing appears out of nowhere to help the main character(s) overcome a seemingly impossible challenge. Deus ex machinae (the plural form) are frowned upon by critics and should be avoided at all costs, as they make it seem as if the author is too lazy to think of a way the main characters to, against all odds, win the day.

Examples of Deus ex machina

 * A stronger character coming out of nowhere and killing or driving off the villains.
 * Note that there is nothing wrong with an existing character going to the rescue of another.
 * In this case, "existing" means an established character, not the guy who appeared once and exchanged a word with the hero.
 * A rockslide or other natural disaster kills the villains.
 * The hero "suddenly" remembers something that their magic could do, or that the ring on their finger is magical, and uses that magic to help them.