Once again, thanks everyone.
Spent all afternoon putting in earths and checking stuff. Seems the 'click' is most likely a short as the headlamp bulb/connector appears to be the culprit here. For example, when only the low or main beam are working, the headlamp connector gets hot as do the wires. When they are both working, the connector does not get hot. Seems to me a problem with the connector/bulb set up so I'll replace both. If this does not work, the next port of call will be the switch, although this seems to work fine when the lights decide to come on. Incidentally, since putting on the extra earths, the headlamp going out doesn't seem to affect the rear, speedo and running lights or the horn, which it did before.
I hate the bulb connector as they seem really idiot about face. Is there a better set up out there that actually means the bulb gets a proper contact from the connector rather than screw it on and hope for the best!!