(The) Rapin (History of England, iv. 297) tells us that a bandbox was sent to the lord-treasurer, in Queen Anne's reign, with three pistols charged and cocked, the triggers being tied to a pack-thread fastened to the lid. When the lid was lifted, the pistols would go off, and shoot the person who opened the lid. He adds that [dean] Swift happened to be by at the time, and seeing the pack-thread, cut it, thereby saving the life of the lord-treasurer.
Two ink-horn tops your Whigs did fill With gunpowder and lead; Which with two serpents made of quill, You in a bandbox laid; A tinder-box there was beside, Which had a trigger to it, To which the very string was ty'd That was designed to do it.
Plot upon Plot (about 1713).
Source: Dictionary of Phrase and Fable, E. Cobham Brewer, 1894