As Mrs. Mitty steps into the drugstore to grab some last minute item, Mitty stands against the wall outside and imagines that he is standing before a firing squad. This is the last of his five fantasies.
It's important to note that "The Secret Life of Walter Mitty" both begins and ends inside Walter's fantasies; in this way, you might argue that the plot of the fantasies themselves and not the plot of the real world dominates the text's action. Another way to interpret this is as a sort of victory on Mitty's part, as far as the story is concerned. He uses his fantasy world to combat what he dislikes about reality, and it would seem that his fantasies are winning out – at least as far as this story is concerned. They dominate reality.
On the other hand, Walter is facing a firing squad – hardly victorious; he's about to be shot. You could view the firing squad symbolically, as representative of the people in the real world who hassle Mitty about being a dreamer. In this sense, the ending seems like a defeat for Mitty. He can dream all he wants, but there are always going to be people who "shoot" him for it.
And yet, to flip-flop around again here, we should notice the language that Thurber uses in the final paragraph, or even this final line:
"To hell with the handkerchief," said Walter Mitty scornfully. He took one last drag on his cigarette and snapped it away. Then, with that faint, fleeting smile playing about his lips, he faced the firing squad; erect and motionless, proud and disdainful, Walter Mitty the Undefeated, inscrutable to the last. (the last line)
The point isn't that Walter Mitty is up against a firing squad; rather, Thurber focuses on Mitty's victorious attitude and demeanor. He is Walter Mitty the Undefeated, despite his circumstance. This is a testament to the power of the human will and imagination – Mitty is still strong and proud, even though he's treated as a nobody by most of the people around him.