Are you sure it's not the ignition switch? mine failed and when I wiggled the wires that ran down the left side of the tank it came back to life... This happened when I was out bush so had to tolerate it until I got back to civilisation 3000kms later!
It got progressively worse and I tried auto electricians and the like to no avail. Had to get the switch replaced in Brissy when I got home.
I could get it to start if I moved the bars rapidly hitting the stops as this jolted the bad connection in the switch, a wiggle of the wires under the switch would also get it to work...
Became dangerous when it cut out while riding, dumped me in a gravel carpark one time and cut out while overtaking...
Now all good with the switch replaced under warranty.