Is this the cable running to the motor? If so, it may be the hall sensors are buggered if disconnect happened while riding. If the plugs are coming loose, then something is wrong with at least one side of the connection and should be replaced (either the wiring harness side or, more difficult) the motor side. Either way, if you can't do that, an electrician should be able to, once you have the parts.