This regularly bites me as well. I have to carefully position query windows -- which for me are always temporary and overlapping my main channel windows -- by the edge of the mIRC parent window before I drag the files, else they'll be lost on the way.
I usually forget to do this the first time, even if the problem bit me minutes earlier.
I'd gladly buy another mIRC licence just to have this feature made optional, it bugs me so much. :-)
It didn't always happen, either. I can't remember when it started but earlier versions of mIRC (maybe from a couple of years ago, maybe more) didn't do it.
It'd be much better of it was done the way Windows itself does it with the taskbar. Dragging over windows shouldn't bring them to the front and if you need to bring something to the front while dragging then you hover over its taskbar(switchbar) button for a couple of seconds.
(Of course, I don't mind if there's an option for poeple who prefer the current behaviour.)
EDIT: This even happens if the query window is on the Desktop.

If your mouse crosses the main mIRC window on the way then you lose the query window if it's overlapping, just like when it's a child window and overlaps another child.