*I have a feeling this question is a duplicate, but I can't find the original. If you can, please post link and close the question.*

There is every now and then that a player character does something extremely stupid because "it would be fun". What are some good ways to handle this as a GM, for the different styles of gameplay. I like telling sandbox non-epic stories, which makes matters all the worse. 

Just the latest example:
>DM(to Player 4): You are walking a wide trade route, lined with large white stones. The surrounding hills are homes to small fortresses, protecting the city in the distance - Zvezdovryh. After your tiring travel, you approach the huge gates, when something very much out of the ordinary happens - men on horses rush out of the gates, cutting down the helberdier city guards. The horsemen keep coming and coming, rushing on the wide road under arbalest fire from the walls.  
Player 1 & 2 (their characters are well to the side of the road) We stay and watch, ready to draw weapons.  
Player 3 (on the road): I sprint towards the hills.  
Player 4 (on the road): I move to the side of the road, draw my bow and start shooting at them.  
DM(to Player 4): At first no one notices you, but when you kill one of the front men, a detatchment of five rushes you. Roll dice.  

Needless to say, the newly-created inexperienced rogue get slaughtered. Worst part is, that was 4 hours of character creation versus 1 minute game time.