The story
From sore + head, perhaps specifically from the simile like (or mad as) a bear with a sore head.
First known use, by meaning
- from 19th c A politician who is dissatisfied through failure, lack of recognition, etc.
Etymology from Wiktionary, CC BY-SA 4.0.