Aha, found it. It wasn't in fact thread priorities at all, so sorry for sending you off on a wild goose chase. It was actually to do with my event loop occasionally getting wedged in a way that only a Windows message would break it out of, and this didn't cause problems while the window had focus because it was scheduling itself a steady stream of WM_TIMERs for some reason or other. The event loop is now more sensible, and the problem has gone away.