I'm betting you have a Microsoft mouse. They tend to do what you describe.

I have a Logitech optical mouse and have never had a problem with it doing it's own thing.