Any way to use ssh to recover a Mac from spinning beach ball of death
To reply to your question: no there isn't such a function accessible
at the window manager level.
It is a good suggestion to forward to Apple MacOS X feedback

Is your Mac still up?

Try:

ping IP_of_my_mac


Can you access it with ssh?

Can you provide us a copy of the output of a:

top -o cpu


and:

tail -20 /var/log/system.log


If the problem appears once more, could you try to kill the loginwindow
like this:
    connect on your mad Mac with ssh

/usr/bin/sudo /bin/kill `ps ax | grep '[/]loginwindow' | awk '{print $1}'`


This uggly command:

ps ax | grep '[/]loginwindow' | awk '{print $1}'


is a trick to give you the process ID of the loginwindow process with no
risk to kill the wrong guy.
I'm not sure this will be enough to force a total free and reset of the GPU.
Please tell me if this doesn't work so I could remove a useless and dangerous workaround.