Definition: the phrase literally means being blown up by your own explosive device. Metaphorically, it means to cause a reversal in someone’s plan (to turn the tables on someone) or to be hurt or destroyed by one’s own plan (or action) that was originally intended for another (to fall into one’s own trap). In short, a self-created comeuppance. A petard is a small bomb, typically a round metal object containing gunpowder with a slow match as a fuse. In wars during the Middle Ages, petardiers (petard experts) would be directed to blow up walls or barricaded gates of fortified cities or castles.
Variants: hoist with one’s own petard, hoist on one’s own petard, hoisted by one’s own petard
Origin: The well-known idiom comes from Shakespeare’s The Tragedy of Hamlet, Prince of Denmark (written about 1601), act II, scene 4, lines 206 and 207. Here is the full passage from Hamlet that places the lines in context:
There’s letters seal’d: and my two schoolfellows,
Whom I will trust as I will adders fang’d,
They bear the mandate; they must sweep my way
And marshal me to knavery. Let it work;
For ‘tis the sport to have the enginer
Hoist with his own petar’; and ‘t shall go hard
But I will delve one yard below their mines
And blow them at the moon: O, ‘tis most sweet,
When in one line two crafts directly meet.
At this point in the play, King Claudius, who is now aware that Hamlet suspects him for murdering his father (King Hamlet), has dispatched Hamlet to England presumably for some vague diplomatic mission — what the Corleone or Soprano family would call a “short-lived vacation.” Hamlet is escorted by two schoolmates, Rosencrantz and Guildenstern, who carry a letter (“the mandate”) ordering the immediate execution of Hamlet. Rosencrantz and Guildenstern are clueless about the content of the mandate. Hamlet turns the table on Claudius (“the enginer”) by roguish mischief (“knavery”) — substituting their names for his in the mandate. Therefore, thanks to Hamlet’s quick thinking, Rosencrantz and Guildenstern, unwittingly carrying a death warrant for themselves, are in for a real surprise when they arrive in England. Welcome to merry old England, lads!
For further reading: Brush Up Your Shakespeare by Michael Macrone, Harper & Row (1990).