If your ex bf is purposely trying to hurt you, I honestly think he has deeper problems going on than being immature.
Immature is a word that is thrown around a lot and IMHO, it's not always used correctly. For instance, I like watching Beavis & Butthead. I'm a 27 yo adult woman with a job, and other adult responsibilities. I don't take the humor in it seriously, but it is very much an immature program. I occasionally do things or say things that may be taken as immature and that's fine, because I make it quite clear that I'm kidding and use my judgment as to when and around whom to act this way. But when the time comes to be serious, I'm serious. Being immature once in a while is fine.
Does that make sense?
Someone who is immature all the time does not recognize the fact that they are, and they wouldn't care if they did. They do not recognize responsibility and real world issues such as respect for other people and a general idea of what is going on in the world. They try to define themselves into icons (i.e.. someone who tries to be a thug, or a Goth or a punk). They try to be an image and they act according to that image. They are deeply influenced by fictional characters (such as people in music videos, cartoons or movies). They have no tact. They do not know how to argue their point when they disagree and resort to name calling. They put other people down over things they assume.
Once a person gets beyond a certain age, if they are still acting this way, I find it best to avoid them at all costs. It's really hard for them to change, although it is possible.
My favorite example of an immature person is a girl I work with. She's about 25 and she works here in a professional , office atmosphere. Well, this girl wears "club gear" to work (often with her gut hanging out over her low rise pants and tops so tight they look like they are 6 sizes too small

). She is very loud , often walking through quiet areas of the office proclaiming anyone in her line of sight to be one of her "party people". She has her cubicle plastered with pictures from teen magazines of various hip hop and pop stars. I mean PLASTERED as in no bare wall, no work documents. Just pictures of 50 Cent. She uses hip hop slang on the phone with customers. She uses 4 letter words loudly and often around her bosses. She talks loudly and graphically about her sex life in front of her co workers. She once sent an email response to a bulletin about looking for nominees to win a public service award, stating that she should get it because "she is in a sorority alumni group and she has to do 18 hours of community service a week anyway". She sent this to the entire company!
To me - THAT is an immature person. I know men like this, and women like this. I'd say it's 50/50 but there may actually be more women. Most people, male and female are not truly immature once they graduate from college and get out into the real world.
Immature people also tend to think of nothing but their own needs in a relationship with other people It's a fine line between immature and insane here. I know a girl who is so obsessive over her fiancé that it's kind of scary. He wanted to have a bachelor party and she went ballistic because she wasn't having a bachelorette party. She lays on the guilt trips and makes him feel awful. Rather than trying to seriously discuss where their problems lie, they usually resort to name calling and tears.
You mentioned this is your ex. Some people simply can not handle breakups. They just can't. Whether this is immaturity or something else is a point to debate. I've known some guys who were very upset after break ups with their gf's and kept calling them constantly. (vice versa as well). Feeling sad / hurt/alone after a breakup is normal. Continuing to obsess over an ex is not. Some people can remain on good terms after they split up. Some can't. Neither way is really right or wrong or better (unless there are children involved; in which case, parents should really try to stay on good terms). If there are no children involved, I find it best to keep your distance unless both parties really want to try again. Get over each other and move on. I actually try to find out how guys I date treat their exes. It's a pretty good indicator of how mature they are in a relationship. My long term, live in boyfriend is generally respectful of exes, even the ones who screwed him over royally. He doesn't talk to them or see them ever, but if he ever bumped into one of them at the mall or something, I think he'd be civil. He doesn't badmouth them or anything like that. I'm pretty much the same way with my exes. I had an ex once who called me a lot and told me stuff about him and the girl he left me for. I don't think he was doing it to hurt me though (because to be honest I couldn't stand him and kind of felt bad for her

) but I think he was just clueless that it's generally bad form to talk about your intimate life with your gf with your ex gf. That is immature.
I have one ex though, who went beyond being immature. He actually called and it started off as just annoying and became scary. I eventually had to get a restraining order, and he eventually did something pretty awful to his new GF and ended up in jail. Yikes.
Purposely hurting people is different and borderlines on sociopathic. I have known people who purposely hurt others, and the ones who know they are doing so are a little unsettling because it's like they get off on the power they feel by controlling someone else's emotions. If he's hurting you, ignore him as best you can. If he's hurting you REALLY bad to the point that you think it may be considered abuse, do not be afraid to ask for help. Without knowing the specifics of what he is doing, I would have to assume he's just being a jerk and not being abusive.
All I can really add is that I hope things get better. I hope he's just hurt and being childish and will eventually move on with his life and leave you alone. In the meantime, I think you should really try and find something to keep your mind off him and try to move on. I know it's hard but showing him that his actions are bothering you will only make him feel like he still has some say in how you feel. Don't let him! And if after thinking more about it, you feel that he is becoming potentially dangerous, PLEASE get help.
Sheri