Well, I have fixed this, although I am not quite sure if there is any good use to call GuiSleep from non-main thread:
GuiSleep waits at most given time, but waiting stops if there are any input events (like MouseDown) to be processed. Anyway, processing messages is always performed by the main thread, so it is questionable why is GuiSleep good for non-mains.