Put it at the very end of a scene, after the mistake has already happened, so it closes the moment instead of starting one. Use Dun Dun Dun before it to build the joke, then follow it with a Vine Boom to underline the fallout.
About this sound
A repeated dun-dun-dun musical sting runs through this just-under-ten-second clip, each low note landing with a little more weight until it reaches its final, closing phrase. It feels tense and theatrical, like a reveal is about to go wrong, and it works best when the moment needs a mock-serious ending rather than a quick gag.