Re: TOS and purely comedic episodes
DS9: Little Green Men is a genuine farce.
Star Trek didn't have a good comedy track record in the 24th century for some reason. About the only time they worked were the DS9 Ferengi shows but even those are hit or miss.
Curly: If at first you don't succeed, keep on suckin' til you do succeed.
--Movie Maniacs (1936)