It can often be the plug, they are prone to melting and also a cause of voltage drop from high resistance meaning a dim headlight (even dimmer than the shitty normal output).
Replacing the factory crap setup with an aftermarket loom and relays can often give a huge improvement in lighting and also fix any gremlins.