This isn't the most efficient solution, but it should work. jsFiddle.
Please note you have to have a position specified in order for the z-index to return a value.
var highest = -999;
$("*").each(function() {
var current = parseInt($(this).css("z-index"), 10);
if(current && highest < current) highest = current;
});
alert(highest);