Chagrin is the sensation you get when you discover you've done or said something you wish you hadn't. For example, a person can feel chagrin for being caught claiming a reference says something it doesn't say.
Or for someone caught ignoring examples contrary to their arguments... LOL! :)