Via SSH should be possible by killing the WindowServer processes. Thats should respawn the GUI completly, and run whatever is used to talk to the displays. Doing this at the loginwindow should be safe as long as you are logging out and not just switching users. It will have to be killed as root, so "sudo killall WindowServer" should do it. , -9 on killall might be necessary if the process is in a bad state due to this issue.