My trick is to have a friend pull out on the tire where the stud is and pull hard so that its tight against the lug nut and use the gun to get it off. Hasn't failed yet.
if this doesn't work then you can pull up or down with the socket as you rap the gun.
you'll probably need a new hub by the end up this.. but you might get lucky and only the stud got stripped out