Why do some people react verbally to intrusive thoughts and/or embarrassing memories?
It might be a way of distracting ourselves, to change the subject and deviate the focus from thoughts we don't like to anything our mind makes up. 


  When anxiety becomes overwhelming, it is the ego's place to protect the person by employing defence mechanisms. Guilt, embarrassment and shame often accompany anxiety.
  https://en.wikipedia.org/wiki/Defence_mechanisms


It is also possible that some of us use this as a way to acknowledge their feelings of shame. we can see this when laughing (when its a honest laughter), as it effectively relax the athmosphere. 

But in any case, we can't "get rid" of a thought. It is only discarded from the present moment and may be intrusive again at another inopportune moment; until we address the issue.