I've never had the misfortune of buying a lemon, mostly because I've known who I've bought from, and I haven't bought that much. All my guns have come from the gun shop in the town I grew up in.
However, the first gun purchase I remember my dad bought a .54 muzzle loader, a SW .22 Mag J frame and a Browning .22 autoloader. The J frame we could never get any accuracy out of, and the other two have been great. All 3 still reside in his safe because... he has room for it there and its inaccuracy is not a safety problem.
For my part, if I were to get a bad gun, it'd go back to the seller if possible, or to Ken (at the gun shop) so he could either fix it up for me or sell it for parts. In either case, he'd need to know exactly what my problem with it was since my long-term relationship with him is worth much more than a junk gun.