chances are it's the wiring pigtail feeding the head light switch.
They melt over time and pull away from the contacts. (another common prob).
You should be able to get the pigtail at the parts house of your choice. and just in case you should probably replace the headlight sw too while your in there. both are cheap enough