Sounds like you have had a day similar to me - DD is 3.2yo and usually pretty good when we eat out - will sit quietly and we can chat. Today however she transformed into an evil goblin version of Verruca Salt in front of my eyes. I think I must have stared bug eyed a bit because I was expecting her head to rotate 360 degrees and green vomit to shoot out... She was literally throwing things off the table onto the floor, smacking her hands on the table and screaming "No" at the top of her voice, puce in the face and tears streaming; all because I couldn't stick back on a 'door' to a cardboard box that had ripped off! I tried everything I could think off - ignore, smile, explain why I couldn't, took her into the loo to try to hug and calm her while explaining she couldn't behave like that and we would have to leave if she continued- thought that one had worked until we got back out there - no! I told her I was going to throw the box away as it was winding her up, which poss made things worse, I then said we would have to leave if she didn't sit on her bottom RIGHT NOW and calm down and eat her lunch. At this point she threw her lunch on the floor and mine with it. I was mortified. Grabbed her coat and bag and marched out with her trailing behind still screaming "Noooo!". I picked her up to cuddle her and she viciously pulled my hair! Marched straight to the bus station and got her onto the bus (carried her like sack of spuds as she was unwilling to say the least!) and got us home. We had only been out of the house for 40mins!
I think it took me about 2 hours to properly calm down. I felt I had to keep explaining why we were home and why we couldn't do all of the fun things planned, to ensure it had sunk in. I also had the idea I had lost the battle between lovely girl and spoilt brat. It really worries me as I don't often see that side to her, but it is really nasty! It can't be that at under 5 they have these traits set, I am sure it is down partly to encouraging good behaviour.
I think consistency is key. They can't be allowed to get away with small things if you have said no or they will push for bigger things. I told her on the bus how usually I am so proud of her, but today her behaviour was appalling and she needed to know that I wasn't going to let that happen. Tonight I also mentioned it (I felt I needed to reinforce it) and confirmed that Santa will also be watching.
Stay strong - tomorrow she will probably be sweetness and light and you will wonder what you were so worried about!