you are correct nacho ! i FORGOT about the ground circuit being in the bulb socket. [oldtimer's disease AGAIN !]
so now, it's time to find out where the power is coming from.
it is possible the contact inside the socket is twisting when the bulb is being inserted, or possibly the headlight switch is shorted internally ?
beer