Recovering from Sys Rq + r
I found the solution myself just after asking this question.
To switch back the console in which X is running (usually tty7), from ASCII mode to RAW mode execute the following command:
sudo kbd_mode -s -C /dev/tty7
And now everything works as expected again. :)
More information available in the question: What does raw/unraw keyboard mode mean?