My 3 year old boy is a bit accident prone. And the thing we have found that is incredible for helping with the pain of bonked heads is arnica.
Either arnica cream (boiron makes a nice gel) or the homeopathic arnica pellets.
DS almost never has a bump the morning after a head bonk and his headaches go away very fast after a fall, and I believe it's due to the arnica. It's amazing stuff!
It even helped him after a naaaasty fall at Target, while trying on a hat and mittens (the mittens were tied together, as mittens are)... the hat was tickling him as DH tried to take it off, he yanked himself backwards, started to topple and couldn't brace himself with his hands (b/c of the tied mittens), and his head landed on the metal base for a clothing rack. One ambulance ride and ER visit later, arnica is what helped with the hefty headache he had from that experience (I had NO interest in giving him something to help him sleep heavier than he normally would, as ibuprofen would have done).