EDIT: and if that only frees up the keyboard, leaving the mouse stuck... relaunch the guilty app that you killed, and close it again. You get the mouse back!
EDIT: Here's another (new?) way of dealing with it. Keep in mind some apps may crash if you take away their toys :)
Section "ServerFlags" Option "AllowDeactivateGrabs" "true" EndSectionIf this works, X will allow the Ctrl-Alt-(keypad "/") combination to ungrab the mouse and keyboard.