TAKE THE SILICA OUT NOW!
Posting from my phone hence can't post the link, but a bloke on z4-forum had the same issue abcs used silica sachets. It reacted with the water and electricity inside the headlamp and the entire assembly including wiring corroded. New headlight and new wiring was required...
BMW e90 330i M Sport