First, check with the preschool and be sure to follow their rules.
I think its fine to invite just a few classmates, but do not distribute invites at school and try to help your child not talk about his party at school. Inviting only some kids and doing it at school can really hurt feelings.
On the other hand, I have always enjoyed birthday parties as a way to get to know everyone in the class and their parents, so we always invite the entire class. Yes, this means we have larger parties than some are comfortable with. But it also means that I know most of the moms names by the end of the party and can recognize all of the kids in the class (or at least all that came). No one feels left out and there are no hurt feelings. To me, that is worth it. Also, you never know who your child will be friends with tomorrow, so its worth including everyone today. Even know that my kids are post-preschool age we do this, though for DS I think he will soon want to switch to all the boys but not girls, and that will be OK too.