Every now and again, I’ll see a friend complain online that Safari has crashed and that they’ve lost a vitally important window. Usually I chip in that there is a session-recovery feature, even though it seems that hardly anyone knows about it.
If you look in the History menu, the last option in the third block is the one you want: Reopen All Windows From Last Session. This does what it says, restoring your state (although I’m not sure I’d swear that it’ll have saved the contents of that textarea containing that world-changing blog post.
Of course, Firefox handles this far better: the state isn’t just automatically saved, it’s automatically restored. There are ways to get this for Safari, like Glims, but they’re input manager hacks and therefore prone to breakage. (Glims also does a lot more than just session recovery, but that might be a downside for some users.) Maybe come Safari 5 someone at Apple will have been convinced to make this a feature, but I’m not holding my breath.
In the meantime, remember History > Reopen All Windows From Last Session. If you need to.