Only we know that Big Pussy is a rat for a fact. Tony doesn't (or won't) and can only detect the clues. So in the end, it's his subconscious that tells him that.
Through his work with Dr. Melfi, Tony has been able to dig deeper into his psyche, to understand who he is and get in touch with his emotions; but at the same time, he uses her advice and analytical tools to get by in the mob, as she inadvertently helps him further his position (or often, simply survive) in it.
So after 2 seasons with her, Tony pays more attention to his subconscious, and in his weakened, sick and vulnerable state, his defences are down and can no longer deny the suspicions that have festered in him for the entirety of season 2, ever since the detective told him that Big Pussy is wearing a wire near the end of season 1, and they finally spill out in the boardwalk dream through the talking fish.
EDIT: Corroborated by Sopranos creator David Chase in an interview from the book Dying to Belong:
CHASE: Well, from the get-go this is a story about psychology. A man goes to a therapist. So those dreams are earned, because so much of psychotherapy has to do with dreams. But because its a psychological show, the dreams often have to be interpreted. Because they have to carry a point. And so – “Funhouse.” That came about because I couldn’t bear the fact that we were going to have to do some kind of procedural in which Tony found out Pussy was a rat. Like he was going to have to call up some cop, or some guy would come to him and then he’d follow up on the lead. And they’d stake out Pussy’s house. And they’d follow him to the FBI. Blah, blah. [...] So I thought, “How can he just know it?” Can’t we skip all that crap? And then I thought, well, on some level, he's known it all along. And so he could just have this terrible dream. Every time I have food poisoning, and I've had it too often, it starts off with very dark thoughts. I feel suicidal, very depressed. I'm half asleep. It's in the middle of the night. And I think, "What's wrong with me? What's wrong with the world?" It takes a while before I identify it as a feeling in my stomach. So I tried to do that. So that this knowledge about Pussy was what was poisoning Tony. And it had to be vomited out.