You're looking for Avoda Zarah 17a:
אמרו עליו על ר''א בן דורדיא שלא הניח זונה אחת בעולם שלא בא עליה פעם
אחת שמע שיש זונה אחת בכרכי הים והיתה נוטלת כיס דינרין בשכרה נטל כיס
דינרין והלך ועבר עליה שבעה נהרות בשעת הרגל דבר הפיחה אמרה כשם שהפיחה
זו אינה חוזרת למקומה כך אלעזר בן דורדיא אין מקבלין אותו בתשובה
They said about R. Elazar ben Dordaya that he did not leave any
harlot in the world that he wasn't with. One time, he heard that there
was one harlot in a town by the shore, and she would take a pouch of
dinarim as her payment. He traveled to her, crossing seven rivers. When they were together, she passed gas, and said "Just like this gas
will not return to its place, so too is Elazar ben Dordaya, who they
will never accept him in teshuva.
I've chosen to translate "הפיחה" here as "pass gas," based on my understanding of the word's usage in Shulchan Aruch, Orach Chaim 37:2. This contradicts the Soncino translation ("she blew forth breath") and, apparently, the Artscroll translation as well (or so I'm told). It's possible that they translated the word in this way so as to maintain "לשון נקי," but I don't know for sure why they translated the word in that way. The word clearly means "pass gas" in the context of הלכות תפילין, linked above.
The gemara continues with the extreme lengths that Elazar ben Dordaya went to do teshuva, which he eventually achieved, at the price of his life. A bas kol rang out, proclaiming that he is destined for the World to Come. Rebbi (Rabbi Yehudah HaNassi) was very impressed by this, noting that not only did he achieve life in the World to Come, he also achieved the title "Rabbi."
The lesson is that teshuva is powerful stuff.