Oliver - i am so sorry your son had to experience this. The following advice is just what I would do; you know your situation best. Knowing that this is how the teacher feels about your son, if I were you I would pull him from the class. He should not have to be in a place where someone like that is in the authority position.
I would go straight to the principal with this. No teacher should be able to get away with such abusive behavior. I remember in my little catholic school years ago, my mother immediately pulled my brother from a classroom when she discovered that the teacher, who was a nun, felt spankings were appropriate for my brother and most of the other boys for minor infractions. My brother was simply switched to another teacher for the rest of the year. The emotional abuse your son has suffered seems much worse to me than the physical abuse my brother suffered.
I reiterate what Mamabear said - tell your son that he did absolutely nothing wrong. Perhaps explain that people who haven't had experience with exceptionally gifted kids sometimes don't really believe what they do is possible, and sometimes react very inappropriately.
Good luck to you. the good thing is that you were there when it happened; now you know. I imagine she has done this before and perhaps the parent was unaware and the student just had to live with it.