I disagree with you. No child should hit back in this situation. If hitting is wrong, it is wrong. She needed to get help. It is wrong to exclude, it is wrong to tease. Some very fine teachable moments were lost here (mostly by the other parents) I would have told the mother of the three year old that her child was having a problem, because she was way too young to be trying to navigate social play with kids so much older than she was, and frankly, a Mom who has not noted that her three year old is trying to befriend kids so much older is asking for bigger issues than that. If a three year old hits another child, and a 5 year old has permission to hit back, you could be in for some serious medical expenses, punative damages, pain and suffering, and some therapy for your child when they realize how much damage a child nearly half their age can do in the heat of the moment. You do not want her to feel that badly ever, and if she were to hurt another human being badly, she might not ever get over it, seriously.
Let me tell you a story...it is not quite the same, but something you need to think about. One of my children wanted to get on a blow up play structure obstical course at a fair once. We let her get in line, we gave them her ticket, and we assumed that the people running it knew what they were doing. She was climbing up the stairs to get on the slide, which was part of the obstical course and had funky steps, and ropes on either side for the children to climb. Unfortunately, the people running it were letting kids go too soon behind one another. Our daughter lost her footing and fell, 6 feet, and landed on the girl behind her. It was not our daughter's fault, kids who fall here should have bounced on the inflatable the girl was standing on. The girl had teeth knocked out, needed many stitches in her face, and had to go to the hospital to be checked for a concusion. This was almost 15 years agao and my daughter still feels terrible about it. You don't want your daughter to find out that she can hit someone so hard that they cause teeth to fall out, or eyes to be seriosly damaged, and you do not want them to have to learn to live with that kind of guilt, so nix the permission to hit under such flimsey circumstances.
Kids need to know that when they are in real danger, they can do what they need to do, but a three year old taking someones hat and behaving badly is not one of those situations.
Maybe the thing to do was to tell the iphone Mom that her daughter needed her, and then try to facilitate a more appropriate play group for the younger set, like your 2.5 yo son, and some of the other children who were age appropriate for this little girl.
At school, I would hope that all the kids here would be coached, and that every child who stood by and watched the hitting, teasing, and excusion would also be coached about what to do. I reality, the person who got caught last would be the one to get into trouble, and that may or may not depend on how much slack the adult is willing to give to that indivdual child, which is a sad commentary, but all too true for some teachers, not all, thankfully, but some. As for the girl, if she goes to school with those kinds of skills, sadly, most bullying programs will not do right by her either, because the element that is missing in most of them is that this child's behavior should be documented each, and every time she draws negative behavior to herself so that she can get the kind of social intervention she needs to either not be a victim, or not display bullying behaviors. If you look really deeply into the whole bullying issue, there is a gray zone for kids who are "bully-victims" and they need the most help and are quite possibly the most at risk.
I would say, try to undo the lesson you just taught about having every right to hit back. At 5, she is not going to be able to go through all the conditions you put on when she has that right, and she might not see the adult who will see her hit back...and then, she is going to be the one with the issue, and there won't be much you can do about it at school if she is the last one to be caught...no matter who started it.
M.