I fixed this problem by glueing the shaft of a q-tip to the exposed end of the earphone jack with super glue and letting it dry overnight. The Apple Store said I would have to buy a new iPad, but this did the trick. This works with iPhones/iPads/iPods and any other kind of earphone jack.
Take a q-tip and break it off several times until you get a bit of a concave shape at the end of the Q-tip. It will give more surface for the plug to attach to if it's concave. (The tube from the inside of a Bic pen can work too.) Wet the end of the Q-tip just a little with Superglue (cyanoacrylate glue). Wipe off any excess glue on the side of the Q-tip. Too much and you'll glue the plug in there forever. Be very careful pushing the end of the Q-tip to the exposed end of the plug. Don't let it touch the inside wall of the iPod/iPhone/iPad jack. Press and hold it on the end of the exposed plug for 30 seconds. Carefully set it somewhere that the Q-tip will get some support while drying. Let it dry overnight and pull it out in the morning. Works like a charm!
(Note: I tried this the first time using a paper clip and it didn't work. The glue sticks to the Q-tip much better.)
Also, if you're product is still under warranty I'd recommend taking it in for service. If you try this trick and it fails you will likely void your warranty. If it's out of warranty you don't have much to lose.