More often than not, this problem is caused by a bad connection in the mouse cable. Just test the mouse cable with a multimeter for continuity at each wire. The bad connection is usually at the plug end - caused by constant bending, and/or being pulled out by the cable rather than gripping the plug.
Hope this helps...