The pain in your jaws is due to the collapse of your chewing system (occlusion).
Your teeth help to stabilize your lower jaw as well as provide a means for chewing, speaking and smiling.
Whatever the end goal of restoring your teeth, you need to remove disease from your mouth. Maintain the teeth that are maintainable, remove the others and have your mouth restored to function. Once you get stable your jaw problems can be addressed, and you can begin to get out of pain.