Data is studying humor. He’s simulating a series of classic comedians (including Vartok the Hilarious of Rigal 7) on the Holodeck when the Enterprise flies into an energy cloud or other Techno-MacGuffin and the ship is rocked and sparks start flying out of stuff and etc.
Data hies to Engineering, to find Jordi Geordi explaining to Picard that the warp engines are down and they will need to call in bigwig help to fix them. Meanwhile, the energy pulses have brought to life the Three Stooges in the Holodeck. They stumble around until finding some uniforms (Wesley Crusher takes a pie in the face at some point or other), at which point they are mistaken for the “three warp core specialists” Jordi’s Geordi’s been expecting. Jordi Geordi leaves Engineering, after Moe promises “you won’t recognize the place when we get through with it.” Things do on from there, until Worf appears, surveys the damage, and fumes, “It’s impossible! Impossible!” He then chases the Stooges around so as to inflict grevious bodily harm upon them, but the Enterprise explodes, and we see his ghost chasing the ghosts of the Stooges as the Three Stooges theme is heard.
Actually, I guess that’s why they didn’t do this episode. Once you bring the Stooges in, you can only end the episode by blowing up the ship.