Take your time. Three-year-olds are just learning the very beginnings of courtesy. Your son isn't running away from you, and he isn't saying impolite words to the people you meet, so maybe the finger-gun is a decent greeting from him right now.
Can you break down the motions of polite greeting in your head? When you greet a friend, you look your friend in the face, you smile, you extend your hand, you call the friend by name, you say hello in a friendly voice. (Did I miss anything?) You might commend your boy when he does ANY of these things - "I really liked the way you smiled at Mrs. Jones when she said hello to you. Good job!" This way you'll be giving him input about what he did well, not just about what he did badly.
Keep modeling the right behavior for him and teaching him, but keep your sense of humor as well. He just has to get through this toddler stage. (If it makes you feel any better, he's probably still cute and lovely! Two out of three isn't bad.)