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.
This. A thousand times this.
I've written comedy for the stage - there's a craft to constructing a comedic script, just like any other writing, and it may actually be harder to do than drama. The script is tight, the actors' timing was perfect, the comedy comes from the fundamental natures of each character, and while I agree that Koloth wasn't the epitome of the fierce Klingon warrior, it's quite possible that he felt the mission was just as ridiculous as Kirk did and wasn't taking events seriously.
If any character should have been cast differently, though, it should have been Freeman - Paul Baxley was Shatner's stand-in, and it shows in his flat performance and line delivery.