P.W.
3 years old is pretty young. He will learn many more words from other children, who probably have older brothers and sisters. I would use a very gentle approach. Gently remind your son each time he says "stupid" with what some of the other mom's have suggested. Keep your voice calm and sweet. "Sweetie, let's find a nicer word to express your feelings. The word "stupid" can really hurt feelings." Help your child brainstorm for more appropriate language for the situation without making too big of a deal. Be prepared to do this over and over and over. I agree with all the other mom's......over reacting with compound the problem. Some children are more difficult to get the message across, just consistently remind your child in a kind way and don't expect immediate results.
Also, if Elija calls you "stupid" or tells you to "shut up" you can patiently respond with a Love and Logic technique by saying "I will listen to what you have to say to me when you use nice words and a soft voice like I am." Then go about your business. Don't snub your child. Just don't engage in conversation until he calms down. As soon as he calms down, even a little, jump in there and praise him. That's your chance to talk about a "nicer" way to speak ~ just be careful not to lecture. After one or two sentences kids stop listening.
B., one last thing. I will mention it even though this may not be you at all, but most of us Mom's struggle with worrying about what the other mom's will think and jump on our kids quickly if they error. I know I've done it! If that is you, try to let that go. We don't have to prove to other people that our intention is to bring up well mannered and well behaved children. We all do the best we can and it is my strong belief that patience and kindness works best.....even in the most embarrassing situations.
My Best,
P.