Yes. You splice a three prong plug to replace the 2 prong plug that you plug into the wall.
Instead of splicing you could just
1. take a wire and attach to the metal rack
2. attach ring lug to other end of wire
3. Screw the ring lug under the little screw that holds the face plate on the wall outlet.
As long as your home is wired correctly your metal rack is now grounded.
If you do not know if your home is wired properly you can pick up a checker at a hardware store for a like $15.
The best protection would be a GFCI outlet. You can actually buy a plug in version (not sure of the cost as I just install them when I need them) instead of hacking up a perfectly good T-stat or doing things half way.