Hi ... just thought i would add a little as TMJ dysfunction can be so painful.
TMJ dysfunction is often due to clenching the jaw when stressed or grinding teeth whilst sleeping as already pointed out. Headaches and Migraines are often associated with TMJ pain due to the temporal part of the joint being one of the cranial bones and also due to muscle attachments.
Posture can also play a role as an imbalance of muscle tensions can alter the mechanics of the joint resulting in the muscle and joint having to work harder than it really needs to!
If your still experiencing pain I would suggest getting some form of manual therapy. The muscles and joints of the jaw can still be treated like any other joint!