Occasionally the oil sender unit will short out internally and cause the needle to peg out but return to 0 when the key is turned off.
If you suspect a faulty sender, unplug the sender and inspect for oil leakage and monitor the gauge's reaction with it unplugged to see if you get the same reaction.