If you haven't removed the molding yet, just pry it away from don't try this trick with big framing nails, though.
How To Remove Nails From Wood Trim : After the trim has been removed from the wall, you'll find nails along the length of it.