Model Question: Using a bad feeling for good?

Hi Brooke!
I was talking with a friend the other day and as the conversation progressed I found myself gossiping about another mutual friend. I was saying things that she had told me in confidence. Once I realized what I was doing, I stopped and changed the subject, but now I am feeling guilty. That is not honorable behavior. I’ve been trying to model this, and all I have come up with is to utilize my feeling of guilt to learn the lesson never to allow myself to break a friend’s trust like that again. Is that a healthy model?– I’m not sure I’m approaching this correctly… I think the only positive thing I can take from behaving badly is the lesson I can learn from it, so as not to repeat it.
Thanks much for your help.