|You know it makes sense|
"Spectre of the Gun" (TOS)
Some aliens are going to kill Kirk and the others in a simulation of the Old West, more specifically the Gunfight at the O.K. Corral. Kirk and his companions try all the rational options, such as negotiation or withdrawal, but nothing works. They build a knock-out bomb, but when they test it (Kirk insists), it doesn't work. Eventually Spock realizes it's all mental projection. Here the episode becomes quite sophisticated and raises issues from the philosophy of science. Spock doesn't just suddenly see that it's all mental, he reaches this conclusion logically.
Spock presents his argument very clearly, in terms of "uniformitarianism", the principle that the physical laws of the universe are the same everywhere. Without this assumption, science would be impossible. A scientist carries out an experiment in a lab, and we believe that the same thing would happen in a distant star. Unless we make this assumption then our experiments could tell us nothing about what is happening in other times or places. However, Spock points out, what they have experienced does not match the physical universe. The conclusion, therefore, is that this isn't the physical universe. Spock mind-melds with them to give them certainty of the unreality, and the bullets cannot now harm them.
This is some serious food for thought. There are in fact other logical possibilities. If what you experience isn't according to what you think the physical laws are, it may be that you need to revise your laws a bit. This is one way science advances. However we would normally only consider that after a series of observations. Another logical possibility is that the event is supernatural, but that is not normally considered an option in Star Trek.
Incidentally, it has been questioned whether the uniformitarian principle is really completely secure. But it's the best we've got. Philosophy of science is a very interesting subject. Try the book in the Very Short Introduction series.
The episode is visually memorable. The setting is positively surreal. The sky is red. Rather than a complete town, they are just walking around in a set of false fronts, the bits and pieces necessary for the events. You could say this eventually makes sense in terms of the whole thing being in the mind, but I think it is most effective just to accept it. The world they have entered is windswept, empty, not all there.
Not only is the eventual solution interesting in itself, it's symbolic. "The only thing we have to fear is fear itself" is the moral. The crew calmly face the onslaught. When the bullets fail to have any effect, Kirk moves in for a fist-fight (of course). He beats Wyatt Earp (who, significantly, does look afraid) but doesn't kill him, which impresses the aliens enough that they decide to welcome the Enterprise after all.