Place it near the end of a scene, after a moment of tension, then follow it with a quick reaction to close the moment. Pairing it with sudden suspense beforehand and an amazed response afterwards keeps the joke moving without losing the audience.