When my computer is laggy key sometimes the UI will freeze for a
second, and then the last key i pressed before it froze will be
repeated as if it was held down the entire time (I like setting my
key repeat rather low).
Does this happen when a qube shuts down (e.g. a disposable qube)? I too observe sometimes a few seconds of freeze while a qube shuts down (mostly very large ones, so I think it's related to SSD and trim).
Sometimes key presses are also dropped.
I had a similar issue but it only happened with my USB connected keyboard and not the build-in one. It turned out that a specific USB hub created the issue and when I moved the USB keyboard to a port directly at the computer the issue went away.
Yours might be a different problem, but I thought I'll mention just in case.