It might be the turn signal switch. I had a similar problem a few years ago and had to swap out the switch. Now one headlight turns on spontaneously when the car is off. To fix it, I need to flip the turn signal on. Try messing with the turn signal switch when the lights are on.