deus ex machina - definition and synonyms

noun [singular] literature 

Your browser doesn’t support HTML5 audio

/ˌdeɪəs eks ˈmækɪnə/
  1. someone or something that solves a situation that seemed impossible to solve in a sudden and unlikely way, especially in a book, play, film etc