In the Star Trek: TOS episode "The Deadly Years," Kirk overcomes a serious dilemma involving Romulans in the neutral zone by means of a handy trick.

But in Star Trek II: The Wrath of Khan, Kirk was confronted with a similar circumstance. He had to cheat his way out of it by reprogramming the computer.

I've always hated that.