Does this problem happen in all applications, or just certain ones? Are you on a laptop, or a desktop system? It is possible for the keyboard to go... or the circuitry within the keyboard. A key is nothing more than a switch -- when you press it, the key completes a circuit, and the keyboard control chip encodes a code on what key was pressed.
Since the Z works, but z doesn't.... my guess is that the key works, and that the problem is in the keyboard controller chip. Easiest way to repair is to get a new keyboard.