Did it only happen when using the high beam switch? If so, I'd suspect the high beam switch. If, on the other hand it was happening when turning the headlights on or off, I'd suspect the light switch. High beam switches, because they are exposed to so much water, dirt, etc. are often the culprit. Also, before spending a lot of time on the switches, check the wiring and wire connections.