I would have called PlanetBike and explained the situation, I'm sure they would have replaced the entire headlamp without any additional expense to you. I do feel your pain (honestly! ).
Perhaps it's a sign that you're due for a new, better headlamp. In for a penny, in for a pound (£), time to lighten your wallet