Where in the gemara does it say a woman never forgets the first man she was ever with intimately? This is something I have recently heard. Is this referring to all women or just specific cases?
The Talmud, Pesachim 112a, says:
דאמר מר גרוש שנשא גרושה ארבע דעות במטה
When a divorcé marries a divorcée, there are four minds in the bed
Rashbam explains that each participant is thinking about their first partner:
בשעת תשמיש זה לבו לאשתו ראשונה וזאת לבעלה הראשון
This would seem to indicate that you never forget the people you were intimate with in previous relationships.
(thanks to mevaqesh for the source)
Maybe what you are looking for is about a man never forgetting his first wife in San. 22a:
א"ר שמואל בר נחמן לכל יש תמורה חוץ מאשת נעורים שנא' (ישעיהו נד, ו) ואשת נעורים כי תמאס מתני לה רב יהודה לרב יצחק בריה אין אדם מוצא קורת רוח אלא מאשתו ראשונה שנא' (משלי ה, יח) יהי מקורך ברוך ושמח מאשת נעוריך
Rav Shmuel bar Nachman said, "for everything there is a replacement except for the wife of one's youth as it says, 'And the wife of you when she is rejected (Isa. 54:6)'. Rav Yehudah taughter Rav Yitzchok his son, 'A person doesn't find pleasure except from his first wife, as it says, 'Your womb shall be blessed and you shall be happy with the wife of your youth (Pro. 5:18)".
I think that this Gemara is what you are looking for, despite that it is not exactly the same words. The issue is the strenght of the alliance into which the wife enter with her husband.
R'Samuel B'Unya said in the name of Rab: A woman [before marriage] is a shapeless lump, and concludes a covenant only with him who transforms her [into] a [useful] vessel, as it is written: For thy maker is thy husband; the Lord of Hosts is his name