Ok, I'm sure anyone who has spent some time working with Cisco routers has "locked themselves out" of a router they are remotely connected to at least once. Recently I picked up a tip that can keep you from having to drive out to the remote site, or call up someone there and have them reboot your router.
I've found that when building IPSec tunnels its incredibly easy to screw something up and find yourself with a dead ssh session. Although I try to proof read my scripts as carefully as possible before doing the old paste to host routine, mistakes still happen. This is how I prevent lengthy down time due to a mistake:

Before pasting into my remote box, I issue the reload command, only I set it to reboot after a certain amount of time. So it looks like this.

router hostname> reload in X
router hostname> config t
router hostname# this is where I paste my script in
router hostname# exit
router hostname> wri m

where X is the number of minutes you want to wait until the router reboots itself. That way, if the connection gets dropped, the router reloads itself before memory is written, and you don't have to drive to the remote site. This feature of the reload command has been a big time saver for me. Hope this helps.

TK