I've had a similar experience with a professor. We used to chat about more advanced topics after class and he seemed really happy that I took an interest in his subject.
Some years ago I was giving a recruitment talk at the university and I bumped into that teacher. I greeted him like an old friend. He said "Oh, you were in my class?" as he hurried off. It hurt and I felt so silly for it.
On the other hand, I've had elementary school teachers approach me with a smile while I was in my late twenties.