Plot summary
While configuring probes to explore a nearby nebula, Data and Jenna D'Sora discuss the latter's lingering feelings for her ex-boyfriend. Data attempts to comfort her, but does not notice her developing affection for him. After another work session, she kisses him on the cheek and then on the lips before leaving. Data seeks the opinion of his friends, including Captain Jean-Luc Picard (Patrick Stewart), Guinan (Whoopi Goldberg), Geordi La Forge (LeVar Burton), Commander William Riker (Jonathan Frakes), Deanna Troi (Marina Sirtis) and Worf (Michael Dorn), about the advisability of attempting to pursue a romantic relationship with D'Sora.
Soon, Data goes to D'Sora's cabin with a bunch of flowers, and he informs her that he has created a romantic subroutine for the relationship. Later, D'Sora visits Data's cabin with a gift, but is frustrated by Data's lack of understanding of how to interact with her in an affectionate manner. At Data's next visit with D'Sora, he acts erratically, trying to find an appropriate response to make her happy.
Meanwhile, as the Enterprise explores the nebula, numerous odd phenomena occur on the ship: objects fall off of tables; Data's cat Spot escapes from his quarters; the observation lounge briefly depressurizes. When the ship approaches the coordinates of a planet, they find nothing there. It becomes evident that the nebula is causing distortions in space; Picard orders the ship to leave the nebula as quickly as possible, but this speeds up the distortions. Data discovers that pockets of dark matter are causing the distortions. The ship can detect the pockets at short range, but not in enough time to move out of the way.
Worf proposes using a shuttle to lead the Enterprise out, and Picard insists on piloting it alone. Picard pilots the shuttle through the field of distortion pockets, and the Enterprise follows closely behind. Chief Miles O'Brien (Colm Meaney) transports the Captain back to the ship before the shuttle is destroyed; the ship is now close enough to the edge of the nebula to leave without further damage.
Afterwards, D'Sora reveals to Data over a romantic dinner in his quarters that she broke up with her boyfriend because he was emotionally unavailable, and then pursued Data because he was the same. Data realizes that she is breaking up with him and responds that he will delete the subroutine. D'Sora departs and Data is seemingly unperturbed, although Spot jumps into his lap as if to comfort him.
Credits
Adapted from Wikipedia contributors, In Theory. Paragraphs and formatting adjusted; illustrations, reference markers, block quotations and non-story material omitted.