If/when this happens again, don't tell him he's been misinformed. Don't argue with him or encourage him in any way. Simply change the subject, or bring an end to the conversation however you see fit. You will feel better after encounters like this if you assert yourself a little more.
Also, I get the impression that you didn't feel that he was deliberately trying to insult you and ruin your day, but rather, that he was being ignorant, irritating and a bit rude while at the same time attempting to convince you of his point of view. I think you shouldn't let it bother you too much. Maybe in a different situation where you had more time, and an inclination to do so, you might have engaged with him and taught him a few things to clear up his misunderstandings. Then you can come back here and tell everyone how good you felt about it afterwards.
But that's just me. I will always have more respect for someone who greets me and acknowledges me as a man, even if they're talking some complete BS, than people who will never speak to me based on my beliefs, or the color of my skin.