Deus Ex Machina
The Latin pharase god from the machine is a reference to any character who appears at the end of a play to solve some unsolvable difficulty.
deus ex machina
Literally God from machine. A Greek theatre convention where a deity is flown to the stage from above or raised from below using a machine mēchanē to solve a problem. A contrived solution to remedy an apparently insoluble plot issue. Convention from 5th century BCE playwrights Aeschylus Sophocles and Euripides and described by Aristotle Poetics and Pollus Onomasticon. Various Greek and Roman crane machines are described by Vitruvius De Architctura none are specific to the theatre. A team of engineers from the University of Patra are investigating stone slots in the earth behind the scene house at the Theatre of Phlius Corinthia. They speculate these may have been sockets for a crane base. No other extant evidence to support design.""
4th century BC
The Deus ex machina was a machine in ancient Greek theatre, used to lower down an actor with the help of a crane (mechane) or lift them up through a trapdoor. The "God through the machine" solved an otherwise unsolvable situation, often to the surprise of the audience.