I've done it fairly recently, and it worked fine, mostly because the player character in question was a rather 'soft' mole. She wasn't purposefully planted in the party to undermine them and bring them harm; rather she was an agent of one of the major bad guys, sent to gather information on the location a magical artifact, who fell in with the party by circumstance before they ever came into conflict with said bad guy.

When the cards finally got laid on the table, characters were shocked and angry, but players were all pretty level-headed about it, because the character's transgressions had not manifested in problems in the moment-to-moment adventuring gameplay, and the character's camaraderie with them was genuine. Nobody felt that their time had been wasted or their trust as players violated (again, out-of-game; the characters were pretty sore about it). It then turned into a plot about the character trying to redeem themself by turning double agent and feeding false information back to the bad guy. The traitor player has some attention issues that make it hard for them to stay focused over long sessions, and the traitor plot was something we worked out to help keep them engaged.