I think your child is still very young and you will learn to pick your battles. Free (?) library class called Math for FUN intended for kids twice older than yours should not be a source of intense frustration. Unfortunately life with a gifted child will be FULL of roadblocks, sadness, loneliness and not just for a child but for the parent as well. You don't have to go through it "ducking your head and apologizing" but you do have to be cautious and considerate. Feeling inferior sucks, especially for kids. And yes, it does make a difference if the child is half the age and showing off to others, it does add insult to injury. If an age group is set, you can always ask for an exception but not feel entitled to it because your child is gifted. And sadly it will happen everywhere even in art and music.

Your point was that he would get the social interaction in this class. Trust me, most (if not all) 2nd or 3rd graders would never accept a 4-year old as their equal and interact with him in that manner.

Best of luck!