P.M.
Here's just one entry (wikipedia) for Proctalgia Fugax. Sounds like it might fit your situation:
"During an episode, the patient feels spasm-like, sometimes excruciating, pain in the anus, often misinterpreted as a need to defecate. … It is recurrent and there is also no known cure. … It is not known to be linked to any disease process and data on the number of people afflicted varies, but is more prevalent than usually thought. … The pain episode subsides by itself as the spasm disappears on its own, but may reoccur.
"Sometimes there is a drop in blood pressure that may cause loss of consciousness and possible injury. Staying down is suggested if in bed, and lying down is recommended."
I've had episodes of this, but without fainting.