I don't know if yours is the same problem as mine. You said it only happens sometimes, so I wouldn't think it was a software problem. But who knows.
I could tell mine was hardware, because I could get it to happen by the way I clicked. If I pressed down the button really slowly, I could get always get the double-click to happen. It seemed like there wasn't a clean contact. Like when the button got down to where it was just about to make contact inside the mouse, it would contact then uncontact then contact again. It's hard to explain clearly. If I just held the button down halfway and moved it up and down a tiny bit, I could get it to register a whole bunch of clicks without ever actually clicking all the way down.
Like I said, I don't know if your problem is the same. But the symptoms sounded like mine.