deus ex machina

Noun
  1. any active agent who appears unexpectedly to solve an insoluble difficulty
deus ex machina
A playwright introduces a deus ex machina to resolve the final act.