Putting aside the fact that it's funny, a lot of reason why I
like The Trouble With Tribbles comes down to it being so well plotted. David Gerrold crafted a really beautiful script where everything that happens in Reel 3 gets set-up in Reel 1, so there's a nice watertight feeling to it, there aren't any plot holes.
Just about the only thing which feels almost
like an ass-pull is Darvin being a Klingon, but even then it's neat because we already know
the Klingons want to sabotage Sherman's Planet, so it makes sense that they'd have an operative on the space station.
What really makes it sneaky great, is how things literally start piling on Kirk in this episode - First the grain with the attached bureaucrat, then the Klingons, the bar fight, Cyrano Jones, and the slow and steady tribble explosion. It seems to be spiraling out of control until, at the end of Act III, Kirk (in the finest tradition of Laurel and Hardy) opens the UPPER hatch door, and he gets buried in tribbles.
Also, outside of the bar fight, and Kirk getting a Tribble shower, almost all of the 'comedy' is character driven - almost everybody gets their shots in -even Spock! "He simply could not believe his ears!"
And Shatner is at his comic best here - all the little touches, nothing hammy at all - Jones, after questioning, leaves saying 'I have a ship to tend to - au revoir
', Kirk does the same after having it out with Baris again - even using the same gesture - not in the script! And the range of his reactions during his little talk with Scott is perfect. That little scene is still one of my top 4 or 5 Trek scenes of all time.