I had a similar problem and it turned out that the earth lead in the engine bay was the cause. The connection looked okay however it needed taking off, cleaned and fully tightened. The earth in question was behind the brake master cylinder. Best of luck.

Ken