CMD-Z reopens last tab instead of undoing This is unbelievably annoying, since when I code online, there is no means of undoing, and thus retrieving the text I deleted.
Most online text editors which support keyboard shortcuts (like the Stack Exchange editor right here!) support ⌃Z (ctrl-Z) for undo too, which won't cause any system functions to be fired.

If you want to use ⌘Z, you can remap the Undo Close Tab function off ⌘Z to something else using System Preferences → Keyboard → Shortcuts → App Shortcuts. Set Application to Safari.app, Menu Title to Undo Close Tab and Keyboard Shortcut to something other than ⌘Z.