Following this logic, perhaps mIRC should only do the following:
1. If 321 is received, open the window
2. If 322 is received, check for the window, open if it is not opened.
Those should be the only cases that cause the window to open.
If a disconnect occurs and the window isn't open yet-- it shouldn't be opened by the event. In other words, disconnection should never open the window for any reason whatsoever. Only the raws 321 and 322 should perform a CreateWindow. I'm not even sure why mIRC creates a window on disconnect anyway.
I think that would solve the discrepancy.