The wires are the headlight socket connect can become intermittent. I had this issue on my 94 325i. Remove the connector from the headlight. If I remember correctly (it was a few years ago) I think I used a pair of pliers to squeeze the wires a bit to reseat them. Just be gentle at first and look at it to figure out how to secure the wires. I just can't quite remember the exact details, but it definitely was "loose" wires at the plug.