You can use silicone to refill it, i use Permatex Ultra Black silicone this can be bought at most Auto Parts supply stores or Orchard Supply hardware stores about 4 bucks. What you do is apply a dab on your finger and fill in the area where the old rubber is coming off,i let it sit for about 10 to 15 secs then wipe off the silicone around it with a paper towel or terry cloth. leave it overnight or let it sit there for a couple of hours and it will set. This silicone is mainly used to make gaskets so it wont glue itself to things.
Try the following 2 suggestions, 1. with some canned air clean your dock female port on the iphone, make sure there is no lint or corrosion in there. 2. plug in your headphones into the headphone jack several times and blow some air into it as well. I ran into this issue when i had my 3gs, the firs time i had something stuck in the headphone jack and the second my wife left it outside and port got corroded so i cleaned it with some Alcohol and small tooth brush and it started working again.
I have used it for several years cleaning out boards and other electrical parts with no issues, i have not seen any water residue left behind. You can purchase pure alcohol at some grocery stores but it runs about 20 dollars for a 750ml bottle typically its about 94-99% Alcohol.