The Simple Dollar has a great post on what to do when you find out you've purchased a defective product. The takeaway points: Respond quickly, document the problem, and don't get emotional. Blogger Trent Hamm writes:
Document the exact problem, with photographic evidence if possible
As soon as you discover something is wrong, stop. Don't continue to open the item. Don't get frustrated and chuck the item. Stop and record the problem. Take pictures or video of the problem so that the issue is recorded as clearly as possible, even if it's something trivial like moldy bread or rancid chips. Take detailed notes as well, describing when and where the product was bought—a receipt is often good to have around, too.... If you feel that action is necessary, write out your entire case in detail before you make a move
Many people dive right into contacting people and raising issues without really having all of their facts collected. Take a bit of time and collect everything you've documented and all information that's available in one place before moving forward with the issue.