I've heard of this before, and even had a DM tell me of this happening to him because his players were so random he had no idea what they had planned so he could never get anything ready ahead of time. He finally went ahead of made this speech, and this final boss character, and before he even got two sentences into his "I'm taking over the world and this is how I plan on doing it" speech, his players told him to roll initiative, and absolutely raided him because he was being caught flat-footed. He was in the middle of his speech, he wouldn't be ready.
I experienced that myself this year during my one-shot that I ran on Friday at a convention. I had an entire army coming to attack (250 people loaded with weapons), and when the mages in the party saw this, instead of gathering up the townsfolk like I had thought they'd do (and even suggested to them), they just looked over their character sheets, asked how far away they were from the ships, how close together the ships were, borrowed the battle belts from their melee friends, and fired off their major spells. I didn't think anything of it until I saw the ridiculous number of 6's and 10's coming my way. They were maxing out the spells without the Maximize Spell feat. Not to mention they rolled criticals. In one round they had wiped out the entire army. Granted they hadn't taken on the boss characters yet, but I was still stunned at what happened. I mean, 250 soldiers were wiped out by one wizard, cleric, and sorcerer. The only thing said afterwards were by the fighters going "Aww, you didn't leave us any?"
Seriously?
How do you compensate for this? Is there even a way to do it? I mean, I had as much fun as everyone else, but I hadn't foreseen any of the players rolling that many criticals, nor maxing out their dice every time. Not to mention my rolls sucked, and I couldn't hit any of them until I finally got lucky and rolled a crit with max dice to knock a character to zero, but that was only the one time. At random points of the game I pretended to admire their dice while looking for a second 20 on the die (I know they exist because I have a set myself).
I'm not sure when the next time I'll be DMing will be, but I do do one-shots and tournaments at conventions so it'd be nice to know some tips and tricks for future games.