I use the "pounding headache" as an escape route from time to time. the secret is in careful planning. I tend to lay the groundwork early.
Before you leave the house, mention that you have a small thumping pain in your head "but it should go away when we get there and i have some thing to eat/drink". In our situation, RN fusses a little over me when we first get there, getting me a drink/small snack. When asked if i need a tablet, i tell him that it's not that bad.
Then as Idiot's rambling intensifies, wait a little while, then mention to DBF that your headache seems to be getting worse, but you will stay becasue you don't want to be a burden. then when the Idiot gets to a point where you want to haul off and throw a glass at him, touch your DBF on the shoulder, and say very quietly, Sweetheart, i hate to do this and ruin your time, but could you take me back to the hotel. my headache is excruciating.
When painkillers are offered, politely thank the person, but say that you find the best thing is going into a dark quiet room for a lie down.
I have used this technique plenty of times, and not once have i offended anyone. RedNuts family are wonderful people but some times the pain of biting my lip gets to much so i plan ahead for the next visit.
People might find this mean or deceitful, but i find it is better to do it this way as my husband tends to get suspicious about "sudden ailments" whereas he knows i get really bad headaches from wearing glasses and contact lenses. The "bonus" is that these headaches actually can't be stopped or dulled with painkillers. so he is more likely to believe me if he can see it develop over the course of the day.