Whenever you have to pull nails out of a sheet-rock wall, you have to be very careful that the hammer, as you pull, doesn't punch a hole through the sheet-rock. So here's a tip you can use. Take a wide putty knife, slip it behind the hammer, and use that to protect the surface.
If you have nails that are a little too far in for the hammer to grip, try end-cutting pliers, also called nippers.. Just grip the nail and rock the cutters back and forth. Keep taking it down to the base of the nail until you have the entire nail out.