I can see from testing that the if condition in your $("body").keydown handler isn't firing. While ctrlDown does get set to true, for some reason your series of conditions isn't firing. I don't think storing key codes and ctrl state in the global scope is going to be a great approach.
Rather than a separate handler testing for ctrl usage, it'd be easier to test just within the "z" keydown handler for whether Ctrl (or Meta i.e. command, to be Mac-compatible as well) is being used. The event object has Boolean properties ctrlKey and metaKey for just such occasions. So your code would be:
$("body").keydown(function(e){
var zKey = 90;
if ((e.ctrlKey || e.metaKey) && e.keyCode == zKey) {
e.preventDefault();
return false;
}
});
This is still not quite as robust as it could be, since you'd want to only check metaKey on Mac and check ctrl on Linux/Windows to handle a few edge cases where someone might press "Meta + Z" (does that do anything in Windows?), but it's close. It works on my Mac.
A caution—& you've probably already considered this—that disabling OS-level keyboard shortcuts can be really dangerous. It messes with user expectations in a bad way. If you're overriding to do something similar in a big browser app, that makes perfect sense, though. Be careful!