Technically it’s a mine, usually laid under a defensive wall in a tunnel called a “sap”. “Hoist by his own petard” was when a sapper lit the fuse to a petard then ran down the tunnel, but the fuse was too short and the resultant explosion would blow the sapper out of the tunnel.