How can I replace a pressure gauge on a well pump?
Turn off the power to the pump. 
Turn off the feed to the house (there should be a valve between the pressure tank and rest of house). This is simply to make the next step easier.
Drain any water from the pipes where the pressure switch is screwed in. Usually there is a sed valve.
Unscrew the existing gauge. 
Check the T where the gauge was screwed in for build-up/blockage. This may be what messed up the existing gauge in the first place. If there's any, clear it out as much as possible.
Use teflon tape or pipe dope on the threads, and screw in the new gauge.
Turn everything back on.