SDL 1.2.15: Tab-key stuck upon switching back

I’m having a rather odd issue with SDL 1.2.15 and Windows 7 dealing
with alt-tab.

The trouble I’m running into is that when I alt-tab away from the
game, Windows seems to catch the ‘tab’ before SDL can do anything with
it. This is actually okay with me. What isn’t okay is that as soon
as I attempt to switch back to the game using any method…clicking,
alt-tabbing back, selecting it from the task bar…SDL then thinks
that the tab key is now being held down, which doesn’t go away until i
hit any other key, at which point things return to normal.

If you’re curious, the event loop I’m using is here:

http://preview.tinyurl.com/cskmozd

Any ideas?

-Alex