KABOOM! when hitting headlights.....

Check your ignition wiring. Both times I had this happen (more than 30 years between incidents) was due to interruption in ignition. The first time was a loose coil wire. The second was a broken distributor lead. Unburned fuel momentarily accumulated in the exhaust. When ignition was restored, it lit off the fuel with a boom.
I have no idea how your headlight switch could be part of the equation.

You spelled out most of what likely happened but missed the bigger picture... The headlights drew enough power to cause the point of high resistance (probably the bulkhead connector) to momentarily go open.. Thats what cut the ignition but the engine was still turning so air was still passing through the carb which caused the exhaust to get loaded with fuel, when the circuit closed & the engine fired again it lit the fuel in the exhaust...