The ball's motion is transferred to two potentiometers (pots) by two long rollers at right angles to each other that the ball is in contact with. These build up an accumulation of dust and goo that makes the transfer erratic. When you have the ball out of the mouse look at the two rollers. If you see an accumulation of stuff on them at the place the ball contacts them, gently clean them with a Q-tip dampened with alcohol. Be sure to get all sides of them clean. That will fix the problem if dirt is the cause. Pots do fail, but that is very rare. I clean my mice regularaly -- every few months -- to prevent such buildups.