In 1893 San Francisco, Devidians from the future fed on the neural energy of dying humans, drawing Data and the Enterprise-D crew back in time to stop them.
The Devidians, aliens who existed slightly out of phase with normal time, travelled to nineteenth-century Earth to harvest the neural energy of people dying in a cholera outbreak. Their activities left Data's severed head buried beneath San Francisco, where it was discovered in 2368.
Data followed the trail through a time portal on Devidia II and met a younger Guinan living in the city. Picard, Riker, Troi, Crusher and La Forge followed him and encountered Samuel Clemens and Jack London. The crew stopped the aliens' operation, Clemens returned to his own time, and Data's head was later reattached in the future.