WD40 is NOT a lubricant. It's great for getting water out of cracks and crevices (the WD stands for Water Displacer), but it doesn't have very good lubricity and if left in place gums up. (As an aside, if you are cutting aluminum stock with a circular saw with carbide blade, WD40 works great as a cutting lubricant. If you are into that sort of thing.) It really should not be left in any mechanism you don't want to gum up. I recently saw a video (Art's cyclery? GCN?) that recommended Boeshield T-9 Bicycle lubricant for brifter mechanism.
I just went through the frayed STI cable experience myself. The RD cable frayed and snapped. I was able to get the cable end out of the brifter, and I think I got all the frayed cable strands out. My steps were to pull up/peel back the rubber brifter cover, find a few threads of cable end sticking out the outboard side if the brifter, grab these gently with a needle nose plier, and (while gently pulling), actuate the small derailleur lever (the one that lets the chain go to a smaller cog) repeatedly. This allowed the little barrel to rotate, and this exposed the lead cylinder that is the end of the Bowden cable. Once exposed, it was easy to pull out the main carcass of the cable end out, and I did not see any additional cable strands. I may just have been lucky.
I just spoke to Shimano Customer Service about lubricating cables. Most folks on the web say don't add lubricant, but the Shimano customer service guy said that Shimano Special Grease (which I take to mean special grease for cables, SP41) may be used. The Dealer Manual also recommends this grease.
I'm going to get the grease. (Sigh. I've really bought into the Dura Ace mystique, no?) I think I'm going to put some in the little guide that the cable runs through on the inboard side of the brifter. One other thing: folks have made the case that making sure you use a cable end with a ferrule is key to not fraying cable ends. The Shimano cable comes with such a cable end, and it has a key on the outside diameter to ensure that it doesn't rotate. I suspect that this is important.