The Enterprise-D is shown to be stuck in a time loop, with events culminating in the destruction of the ship as a result of a collision with another Starfleet vessel that emerges from a space-time distortion. As each loop proceeds, the crew members, though unaware they are in the loop, have the feeling of dÃ©jÃ vu; Dr. Beverly Crusher begins to hear numerous conversations before going to bed, and during one cycle, manages to record the voices on a tricorder. Analysis reveals that the voices are Enterprise crewmembers seconds before the destruction of the ship. The crew discovers they are in a time loop caused by tachyon distortions near the space-time anomaly, and program Data to send a short message to his counterpart in the next iteration to take action on. Data sends the signal moments before the ship is destroyed again.
On the next iteration, the crew still experiences dÃ©jÃ vu, but actions performed by Data often reveal the number three, going against their previous conceptions. They make the same conclusions from the previous iteration, and Data realizes the number three must have some as-yet-unknown significance to break the loop. The Enterprise again arrives at the anomaly, and as the other ship emerges, both Data and Riker suggest alternate plans to avoid being hit. Though Captain Jean-Luc Picard opts for Data's plan, Data comes to recognize that the "three" message was in reference to the insignia pips worn by Riker, and initiates his plan instead. The Enterprise is able to avoid being hit, and the time loop is broken. The crew discovers they have been stuck in the loop for 17 days, while the ship they narrowly avoided, the USS Bozeman, has been missing for more than 80 years. The Enterprise welcomes the Bozeman to the 24th century at the end of the episode.