Crossing the line into denial?

I am wondering when changing our thoughts about something crosses over into denial of a situation.
Example: Thinking I am doing a fantastic job at work. I get fired. I am surprised by the outcome because all this time I thought I was doing my job well.