Unplugging the parking brake switch will not make the bike 'not run right', it will just eliminate the parking brake RPM limiter. What did you do to disable the pb limiter, what color wires were in the connector you unplugged and can you be more specific about 'not run right'?
Water getting into this connection can also cause the limiter to come on, so when unplugging, you must seal the harness side's connector (the one that has the green/yellow wire) to prevent water from getting in... silicone sealant works well here.
Also, does your reverse light work properly, and did you see any flickering from it (or on at all) when this happens?
This is more likely the culprit: I suggest, the next time this happens, unplug the spark plug boot and see if there's water getting into the cavity. This is very common. If so, dry it thoroughly and then put some dielectric grease on the connection and around the boot where it enters the bore to keep water out.