Originates from Shakespeare's 'Hamlet', where 'petard' was a small bomb. Used metaphorically for self-defeat. He aimed to slander his colleague but was hoist with his own petard when his fabrications were exposed.
Pro Tip 2/3
Archaic Usage
The phrase is old-fashioned; use it to sound intellectual or humorous when describing self-caused downfalls. Trying to short the market, the trader was hoisted by his own petard as the stocks rose.
Pro Tip 3/3
Irony Emphasis
Best used to highlight irony, especially when someone's schemes backfire on themselves. He was finally hoist with his own petard, as his cheating led to his own expulsion.