If you have a multimeter, measuring the battery voltage when it does this may give some indication of what is happening.
Is your battery good and strong - and fairly new.
Does this happen with the engine running - or only with the engine stopped.
If the alternator is not providing charging, it just might be this problem.
Unfortunately, failing this, you are going to have to go through ALL the wiring connectors until you find the problem.
If it doesn't blow the fuse when doing this (?), at least its not the result of a dead short - a wire into a wrong connector somewhere.
Ultimately, finding this problem may involve discconecting all the wiring connectors, and reconnecting them according to the wiring diagram.
I'd start by carefully disconnecting power to the headlamp, wrapping things so nothing can short out, and trying the switch again and see what happens.
You may need to proceed through the whole loom until the problem shows itself.
Don't ignore the taillight/wiring either...
You may need to test the switch too, to be certain it is actually providing a connection.
Wouldn't be the first switch that has failed connections inside. ?
Good Luck !