Something strange happened to me on my ride this afternoon. I rode for about 150 km and then stopped to have a smoke. I turned the engine and ignition off and when I wanted to get going again, I put the key in, turned it and ... nothing happened. No warning lights on, no nothing. It just looked as if my battery was dead. I checked for loose wires and I came upon this one. (right-hand side of bike)

I messed about with it for a while and suddenly the electrics were back. Now my question was it just pure dumb luck? (I think so) Or let me rephrase this question: What is this cable / What does it do?
Also during my ride, I noticed a loss in power everytime the bike had to deal with a (serious) bump in the road. I guess this has the same reason as the problem I explained above.
Oh yes, I ride a 2004 Bonneville, just put 21000 km on it, and it just went in for the 20000 km maintenance (replaced brake pads - oil - synchronised carbs - ... ).