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: Moe, Larry, the cheese! Moe, Larry, the cheese! (Horses Collars, 1935)