Se ti basta che il bottone cliccato passi ad uno z-index maggiore dell'ultimo, puoi tenere in memoria l'ultimo z-index e incrementarlo ogni volta:
<script...>
var zind = 5;
</script>
</head>
<body>
...
<input type="button" ... style="z-index:1;" onclick="this.style.zIndex=zind++;">
<input type="button" ... style="z-index:2;" onclick="this.style.zIndex=zind++;">
<input type="button" ... style="z-index:3;" onclick="this.style.zIndex=zind++;">
<input type="button" ... style="z-index:4;" onclick="this.style.zIndex=zind++;">