Check the ignition switch and/or relay. If the relay is intermittent, the current will only be passed when it's cool.
open