Harsh words against yourself are equally as damaging as harsh words against others.
Don't beat yourself up about it. Everyone has said something or reacted in a manner that they later regretted. It's just human nature.
The main thing is recognising when you do it, and resolving it with the person in question if necessary. If they are no longer around, or the revelation is late, then applying the lessons learned to your relations with others in future is ample enough to make up for any momentary lapses.
In the same vein though, we must be mindful of this when reacting with others, and be a little more forgiving when someone else says something to us that may seem harsh or out of character