I don’t think O’Brien told Thomas (or anyone) about what she did, but he presumably knew enough to work it out. In the last episode of the first series, there are some conversations between Thomas and O’Brien about her belief that Cora is about to replace her, including this short exchange:
[Thomas approaches O'Brien.]
Thomas: Well, you're going any minute. She's advertised for your replacement.
O'Brien: That filthy, ungrateful cow.
Afterwards, near the end of the episode, O’Brien causes Cora’s accident in revenge (though she belatedly changes her mind and is later shocked to learn Cora’s advertisement was intended to find a maid for Violet).
In episode three of the second series, after Thomas has returned from the front, there’s a scene where Thomas observes O’Brien has made an about-turn in her feelings towards Cora for reasons she does not want to state:
[10:28, EXT. COURTYARD - DAY]
Thomas: Suppose I don't want to come
back?
O'Brien: To be in charge? Telling Mr Carson what to do?
Thomas: Why? What's in it for you?
O'Brien: All right, it's to stop Mrs Crawley bossing Her Ladyship about. She behaves as if she owns the place.
Thomas: You've changed your tune. When I were last here, you'd've given money to see Her Ladyship eat dirt.
O'Brien: Well, like you say, I've changed me tune. People do.
Thomas: Not without reason.
O'Brien: I’ve got me reasons.
Thomas: You've also got Her Ladyship wrapped 'round your little finger.
O'Brien: Maybe that's my business. But I'll not hurt her. And I'll not let anyone else hurt her neither. That's all I've got to say.
Thomas: You're a queer one, and no mistake.
O'Brien: So, will you come if I can fix it?
Thomas: Why not? I like the idea of giving orders to old Carson.
[O'Brien smiles.]
[BREAK 1]
I’m not sure we have more to go on. But I think we can assume Thomas knows O’Brien well enough to know she would be capable of setting up Cora’s “accident”. He also knows she had some motivation for it. And lastly, he’s seen her exhibit some sense of needing to make up to Cora. So it seems plausible enough for Thomas to have realized Lady Cora’s “accidental” slip on the piece of soap was no accident at all.
As to the question of why Thomas didn’t use this information against O’Brien earlier when they had their falling out, and left it to be relayed through Mr. Bates, I’m not sure there’s a better explanation than “plot convenience”.