Place it at the end of a reveal or betrayal sequence, after the moment he knew sets up the twist, so it lands as the payoff. Follow it with the fail sound when the plan collapses, keeping the joke on the character who caused the mess.