I have worked with 5 year olds for many years. I think you both under and over reacted!!
I would have stopped the car and went right back into the school to talk with both the teacher and the principal to get the whole story. I would have talked (and listened) to your son both in front of the teacher and alone. It is so important to get the whole picture.
I think many people do over react when it is a boy-girl situation but in reality it matters so little to five year olds!!
AFter you have the whole story, then deciding on the dicipline would be easier.
I also like finding natural consequences. I think you over reacted in anger and surprise. You want to teach him how to behave, not just "punish" him.
TALK to you son and see what is really going on with him.