I don't have any experience with cats purring when in pain, I believe it is possible though. Sash purrs all the time, I know for sure it's because he's very happy and contented. It's such a soothing sound.

Lisa & Sash