At some point during Data's captivity and interrogation by the Borg Queen in Star Trek: First Contact her tries to convince him go into a more instinctual direction:
Borg: Are you familiar with physical forms of pleasure?
Data: If you are referring to sexuality, I am fully functional, programmed in multiple techniques.
Borg: How long has it been since you've used them?
Data: 8 years, 7 months, 16 days, 4 minutes, 22...
Now I was surprised to hear that Data not only is programmed in "multiple techniques", but has even used them before. I might not be the biggest Star Trek expert but I think to have seen a great deal of The Next Generation and the addition of a romantic, let alone sexual, level to Data's character seemed like a very new development in this film, contributing to his ongoing further humanization.
But with that explicit mention of him using those techniques before, I wondered if that is actually a reference to a specific TNG episode where Data had some kind of romantic or sexual encounter before. So has Data explored his own sexuality in any previous TNG episode that this line of dialogue in First Contact references or is that just some arbitrary time period without significance?