-- Shakespeare, Hamlet III iv.
"Hoist" was in Shakespeare's time the past participle of a verb "to hoise", which meant what "to hoist" does now: to lift. A petard (see under "peter out" for the etymology) was an explosive charge detonated by a slowly burning fuse. If the petard went off prematurely, then the sapper (military engineer; Shakespeare's "enginer") who planted it would be hurled into the air by the explosion. (Compare "up" in "to blow up".) A modern rendition might be: "It's fun to see the engineer blown up with his own bomb."
I know the phrase (despite not caring one whit for Shakespeare) but didn’t think it was a direct quote. I was also thrown off by the use of “hoisting” earlier in the thread which doesn’t fit with the King’s English.
I stand corrected.