I think 6 is a pretty good turn out for a 10 yo's party. No one can expect to be liked by all 27 kids assigned randomly to a class together. I think the teacher has no say in it whatsoever, and she shouldn't have spoken about it all. That's just putting too much importance on it, and is interfering in social relationships that should be left outside school. I think they should not bring invitations to school at all, but instead the child should get phone numbers or addresses from the kids they like or want to invite, and then send the invites to their home via the mail. (In some cases phone invites are fine--we do ours by email.)
I also think the all or none rule is pretty unfair to the parents, because they're required to plan for 27 kids, and there's no way 27 kids would all show up. And then, what if the parents were realists and only planned for 10 and 20 DID show up? Not fair. So they should take the party invitations out of the classroom altogether and make the social contacts outside of school.
I think it's cool that your son went even if he didn't care one way or another. I'd tell him how nice it was of him to go, even when he knows other kids don't like the BD boy, and that's a good character trait to have. Then I'd let it go.
Karen