Assuming that you are keeping a birthday party for a 4 year old very small and not overwhelmingly large and frantic, your ex and your girlfriend will be very close together. This is up to your ex to decide, and secondarily your girlfriend needs to weigh in on how she feels about it. If you are having a big huge party (and when you say "sharing costs" I wonder if it's at an expensive venue and there will be a ton of people), then you have to ask yourself if your son is already going to be overwhelmed by the activity and noise level. Is there a lot of work to be done and you want an extra pair of hands? Is your girlfriend the best person to do this?
Ask yourself what the purpose is? Do you want someone to talk to who is not your ex? Not a good reason. Will it be all your ex's family and you are afraid of being outnumbered so you want someone on "your team"? Understandable but not necessarily a good idea. Do you want your ex to see that you have someone in your life and she doesn't? Bad idea. Do you want your ex to get to know this girlfriend to see that she is a decent person and someone your ex can feel secure about her son being with? Better idea, but the birthday party may or may not be the best way to do this. Do you want your son surrounded by all kinds of people who love him? Good idea - but again, he's 4, so he's not going to really connect to who is there and who is not. How long have you been dating this girlfriend and how serious is it? Is her presence in your life likely to be threatening in any way to your ex? Is your ex-wife seeing someone who will be there? Then yes, your girlfriend should be included. That presumes that both of the new relationships are not brand new. Those are just some of the issues to be looked at.
I'm a second wife so I've been there. It's not easy for her to go into a situation with the ex and her group of people. It's also not up to your girlfriend to be upset about being excluded if she's been in your life for less than a year. Sometimes divorced parents are going to do things without the girlfriend/boyfriend or second spouse. Parent-teacher conferences, doctor visits come to mind. At some point, however, the new relationship becomes part of the extended family and I think there has to be some movement to start including her. But so much depends on how long you've been together, how acrimonious your divorce was, and what the relationship is now between you and your ex. If it were up to my husband's ex, I would never had gone to anything at all, ever, for at least 15 years - and that's not good for anyone either.
I do think it's good that you raised the question though instead of just taking your girlfriend along.