It hurts just to read that! It's so sad when children get frustrated but aren't able yet to verbalize what they are feeling.
My daughter didn't head-bang, but the gap between what she wanted to express and what she could express was enormous around that age -- and her frustration level was off the charts at times. There is a Blues Clues video that addresses this, and my daughter LOVED it. They explain that when you are frustrated you should, "Stop. Breathe. And think." There are cute little motions that go along with it too. I don't even know if Blues Clues is still popular or even on TV anymore, but I'm sure you can get the DVDs.
We would see her in the midst of a potential crisis, and then she would act out this little dance, song, chant, whatever it was. It actually calmed her down, and became a ritual that was far more pleasant than an implosion (or a head-banging session).
The other thing I'd suggest is talking him through his frustrations and distracting him. Chances are that even if he can't verbalize what he wants to express he can understand what you are saying to him.
If he's frustrated about something he's trying to accomplish, but can't yet master you can try saying something like, "Oh sweetie, that puzzle looks hard, it must be so frustrating. I would be frustrated too. Should we try it together?" Then get silly with the puzzle. Pretend you are totally clueless, and let him be the one to fix it. Sometimes that can be a confidence booster, or a funny distraction.
If he's frustrated about trying to restrain himself, you can try something like, "I know you feel like hitting right now, and it's hard not to hit when you're angry. You are being so good, and that is really, really hard sometimes. But you know what you can hit? You can hit a pillow! Should we go hit a pillow? C'mon it's fun!"
I think the most important thing to convey to him is that it is NOT okay to hurt anyone, including yourself. If you feel like punching, kicking, hitting or biting, you can do it with a pillow, or a stuffed animal, etc, but never, never with a person or a real animal.
Seriously, when he does this, you need to get down on your knees, hold him by the shoulders and look him in the eye and tell him that that is NOT okay to hurt yourself -- and say it with the same forcefulness you would use to reprimand him for hurting another child.
I completely disagree with the parents (and pediatricians) who suggest that you should ignore this. It might "go away", but it might also resurface in another form years later. No child should think that his mother will ignore him when he's desperate enough to even attempt to hurt himself. (holding your breath is completely different, because as the commenter pointed out, no injury can come of that -- the kid might faint for a second, worst case. But if that same child was even pretending to suffocate himself with a plastic bag or a pillow case, it would be a much different situation.
I don't know if my suggestions will help at all, but I hope you take this seriously.