I just did this last night. The D5100 tear-down guide above was a big help. You need a tiny phillips screwdriver (like for repairing eyeglasses) and tweezers for handling all the tiny screws. A sharp pick tool is a help as well.
*EDIT* Here is the complete guide WITH PICTURES: Nikon D5100/D3100 SD Memory Card Door Replacement
FIRST: open the memory card door and take a good long look at how the spring is installed. There are two "feet" coming off of the spring that need to be installed into two "insets" on the rear camera cover, this has to be done before you put the cover back on.
1. Remove 3 long screws behind the eye-piece (note that the one on the top-left is slightly longer than the rest and uses a different thread), then remove the plastic cover over the diopter (a pick tool is helpful here) and remove the silver screw behind it. (4 screws total)
2. Peel the rubber thumb-grip back slightly, there's a short screw there closest to the left side of the thumb-grip. This one seems to be slightly thicker than the ones in the next step, keep it separate.
3. Remove 3 short screws from the bottom of the rear cover.
4. Remove 2 long screws from the left side of the camera.
5. Peel back the rubber grip on the right side of the camera, closest to the top and bottom behind the rubber grip there is a silver screw (2 total).
6. Once you remove those screws (12 altogether) you can pull the back cover off the camera, it is still attached to the camera body via two cables so be careful not to damage them. You will then see that the memory card door slides right out between the rear cover and the camera body. Install the new door making certain to put the spring back the way it was, with the two feet installed into the insets.
7. Put the rear cover back on and test the memory card door to make sure it's working, then install all of the screws back where they went. Reapply adhesive to the rubber grips and diopter cover if desired.
- Written by Shroud - firstname.lastname@example.org - Link with pictures to follow.