Once upon a time this very thing was a major component of my depression. I could pace and berate myself out loud, for hours, for weeks, over such insignificant little bull**** as having forgotten someone's name, or stumbled through a presentation, or awkwardly delivered a compliment, anywhere from a week to fifteen years in the past.
Last month this happened to me: someone called out OH HI THERE from across a busy store and I replied, thinking it was directed at me, an instant before the person standing behind me did. Crap, how embarrassing. This is the sort of thing over which I would beat myself up for days, and I could do the same thing here, or I could stop it before it started.
First, I recognized it's an irrational and overblown reaction. There is far too much guilt and shame for such a small social misstep, first of all, and second, it helps nobody, not even me, to feel pain over something so slight. Sometimes just telling myself this over and over negates the obsession.
Second, got angry. **** you, depression, this is completely out of proportion. This allows sometimes a bit of clear thinking.. as long as the anger is directed at the overreaction and not at myself, understand. Getting angry at the cause can also help - what was this woman thinking just screaming across a busy store? How rude.
Third, laughed it off. Well, smirked a little. With my dark sense of humor, depression/anxiety are funny to me in a way, and the little ways in which they manifest - like this one. If your tastes are more toward slapstick imagine a piano falling on somebody. Whatever; humor helps.
Fourth, reasoned it out.. this sort of thing doesn't help anybody, and doesn't really matter. I remembered the times I was on the other side of such an exchange. Last month I stopped to ask someone directions, and when she couldn't help me, she thanked me. Why? No reason, it was another such little mistake, and I didn't make a big deal of it at all, nothing bad happened. Then there was the time some guy forgot my name, and I didn't feel resentful about that either, so..
Eventually these steps turned automatic, nowadays I don't have to think about them at all. Whenever I feel some needless guilt/shame coming on I can smile, shrug, and it's gone. The effort is unconscious.
I hope this helps you guys a bit.