Your script opened and closed a window with every mouse-move event? If so, I can see how that could crash mIRC. Maybe windows will only allocate a certain number of window handles, possibly per time period (or something like that). Maybe to prevent runaway programs.
-genius_at_work