You may have read the book ‘The brain that changes itself’ by Dr Norman Doig, or seen the documentary (here is the full documentary). For chronic pain, the brain can also be possibly rewired by shaping, and recruiting different parts of the brain. Read here for more on an example of neuroplasticity from Doidge’s second book The Brain’s Way of Healing
The anterior cingulate cortex (ACC) of the brain, is involved in our perception of pain and our emotional response to pain. The ACC can also become activated when we experience emotional pain such as hurt and rejection. The brain therefore probably does not discriminate between these two. Both are alerting to danger – either physical injury, or emotional (e.g. rejection, or humiliation). Furthermore the ACC can become sensitized and produce pain experience in the absence of pain signals from the body.
In contrast, activation of the dorsolateral prefrontal cortex (DLPFC) area of the brain can result in reduced pain. Positive emotional states are correlated with activation of the DLPFC
Jennifer Gait, a life coach specialising in chronic pain relief has provided a detailed presentation on this
For a technical explanation you may like to read this article on the ACC and this one on the DLPFC