Check the rear brake switch first. As mentioned earlier it's in a rough operating environment. The activating linkage can get road crap in it, messing with the action, not to mention corrosion on the connections.
I had a problem with the rear brake switch on my K100. It is just a standard industrial micro-switch, and I bought a replacement from Radio Shack for something like $2.