Oh, and I just realized an even worse problem that makes it impossible to recover:
Again, in the same situation when you've got unexecuted/unsaved changes in the window, if you hit Ctrl-Up and then GOD FORBID you change the text in the window in any way, even if you type a single character...