That's a strange bug. It's probably something to do with either your mouse or the display. I don't think there's a simple fix you can do to stop this happening, though you might try playing around with the mouse settings via control panel (but keep a note of your present settings in case you need to go back to them). A couplle of suggestions on mouse settings. Is ClickLock selected? If so, try amending the sensitivity. If the timing is too short I can see how this could cause the problem. Also the pointer speed (under pointer options) could be adjusted.
If this doesn't work, then you could try this next time you get the square cursor. Right click on the desktop screen (not over any icon), select properties. This brings up the Display Properties module. Go to settings, and reduce the screen resolution (make a note of the existing one). Click Apply and the display should change. You should get a message saying that the display has been changed - do you want to keep the settings. Click No and the display should revert to the old resolution. (If for some reason this doesn't happen you would need to change this manually). Come out of the Display Properties module. Hopefully (but I give no guarantees) the mouse is now showing correctly.