In ancient Greek tragedies, hopeless predicaments were often resolved through on-the-spot intervention of the gods — or rather actors playing gods — who were physically lowered onto the stage by a crane. Hence the Latin term deus ex machina, literally "god out of a machine."
In its modern usage, this expression typically refers to some astonishing revelation that brings together what had, up to that point, appeared as an unrelated sequence of events.
In "The Devil's Whisper," published in the vernacular in 1989, Miyuki Miyabe shows herself to be a virtuoso. And all the more so because her protagonist is a 16-year-old boy.