Deus ex machina
A resolution parachuted in by an unprepared outside element — the god lowered by machine who saves everyone.
Deus ex machina names a resolution out of nowhere: an outside event, character or power, prepared by nothing, untangles the situation in the protagonist's place. The phrase comes from ancient theater, where a crane (the machina) lowered a god onto the stage to settle the plot.
It's dramaturgy's capital sin, because it retroactively cancels tension: if the cavalry can appear at any moment, no danger was ever real. The safeguard is one principle: anything that resolves the climax must have been planted earlier (see Chekhov's gun, its exact mirror). Coincidence stays tolerable for *creating* problems — never for solving them.
Example
The providential inheritance erasing all debts in the final chapter, never once mentioned before.