*a.k.a. G_d from the machine
There’s a literary plot device known in Latin as deus ex machina. Originally from the Greek apò mēkhanês theós, and used in Greek plays, we have many examples from Judeo-Christian stories. I’m thinking of the biblical story of Job, where the philosophical discussion and events are resolved by the appearance of G_d from the whirlwind, and all is resolved and restored. It is not resolved by the main character, nor by any of the other characters’ actions. In fact, that is the very point the book of Job is making.
In literary analysis this has come to stand not so much for divine intervention as for the addition of an unexpected event or character not organically coming out of the story. Such things do, in fact, happen in real life. But in modern storytelling, where the heroism depends on humans conquering life’s obstacles, it often feels contrived and unsatisfying.
In the how-to circles it's a no-no. If I read or heard it once, I have heard it many times. We don’t do it anymore.
I suggest we do use it, and use it everywhere. This is where fantasy comes in. A whole genre devoted to coming up with world building rules that zig-zag between life as we know it and fantastic elements popping in conveniently to work their magic.
You need the main character to get in somewhere where they can’t possibly? — Introduce, and then give ‘em, an invisibility cloak. Voila! Harry Potter, anyone? Why didn't we know about this magical invisibility thingy all along? Because we just needed it now, silly.
The same for magical realism, a genre I am partial to as a reader and a writer. Think of the uses of time-travel, not in the form of scholarly research, but a device where the main character actually gets to hop in a few centuries back and even retrieve a long-lost object.
Deus ex machina hasn’t gone away. If anything, it is used more than ever. We just have other names for it.