He doesn't deny it. 

"I was very drawn to him and I got the impression he felt the same way. I was wrong," is Thomas' logical response. 

After Carson says that the situation is a very odd mistake to make, Thomas mentions that "When you're like me, you have to read the signs." Just imagine what life back then would have been like for Thomas. It explains a lot about his behavior. 

"I do not wish to take a tour of your revolting world," Carson replies. 

Later, Carson tells him that "you have been twisted by nature into something foul." 

"I'm not foul, Mr. Carson," Thomas replies. "I'm not the same as you, but I am not foul."

Ouch. But it's not like we expected an accepting reaction from him. Still, he's surprisingly sympathetic -- to a degree. He later says that Thomas can resign, citing Bates' return as a reason, and that he will write Thomas a letter of recommendation. 

But, on the urging of O'Brien, Jimmy makes it clear that not only does he think Carson shouldn't give a letter of reference, but that will he tell the police that it will happen, effectively blackmailing Carson. Carson doesn't want any scandal reaching the house, so he tells Thomas that the letter of recommendation can't happen. 

Thomas is enraged and broken. He is resigned to his fate. Mrs. Hughes finds him crying outside of the house, and he tells her what's going on (we don't actually see this conversation, which would have been interesting). Leave it to the good Mrs. Hughes to step in, urging Carson to consider his options with this, that he doesn't have to give into Jimmy's demands. She also calls Jimmy "a vain and silly flirt" and a "young whippersnapper," which further cemented my love for Mrs. Hughes. 

Even Bates, Thomas' sworn enemy, gets involved. He learns what has happened from Mrs. Hughes, and tries to help, telling Jimmy to let it go. 

In the meantime, Carson fills Robert in on what's going on ... and he's surprisingly liberal about the whole thing, which was hard to believe because he's a) Lord Grantham, believer in all things formal and conservative and b) because it's 1920. 

"If I shouted blue murder every time someone tried to kiss me at Eton, I would have gone hoarse in a month," Robert admits. Really?! Hilarious, but really?

And the effort to help Thomas is in full force. 

"What can I say to change her mind?" Bates later tells Thomas about Mrs. O'Brien. And a look of sudden hope comes to Thomas' eyes. 

Bates summons Mrs. O'Brien to the cottage he's fixing up with Anna, telling her to persuade Jimmy to back off and let Carson give Thomas a reference so he can leave with some hope for the future. 

She holds firm, until Bates whispers something into O'Brien's ear and a look of horror fills O'Brien's face. "Sort it out by this eveing or you'll find your secret's no longer safe with me." 

Whatever he whispers works. O'Brien tells Jimmy to let it go, to tell Carson to give him a break. It works, but there's the little matter of what to do now with Thomas, since his job as Robert's valet is done with Bates' return. There's the offer to make him "under butler" (sure), which would technically, make him Bates' superior (awkward). And here Bates thought he was going to get rid of Thomas for good. 

Everything gets resolved at the cricket match. First, we deliciously learn what Bates whispered to O'Brien: "her ladyship's soap." Yes, that would be the trump card that Thomas needed.

At the match, Robert gets Jimmy to back down by thanking him (!) for his "generosity with Barrow staying on" and congratulating him on his appointment as first footman (much to the surprise/chagrin of Carson).

But thing get rough. The police arrive to interrupt the match, revealing that Alfred has called them about what Thomas did. Robert, valiantly, takes Alfred aside, urging him to "introduce a little kindness into the equation."