There was an episode of Star Trek Voyager this season with a similar idea, but I didn't care at all for how it was handled.
The crew of the Voyager discovers that the ship and crew are starting to fall apart. The matter they are made of is beginning to decay somehow. At the same time we notice that recent events which the crew describes do not match the Voyager timeline we have been watching this season. Tom and B'Elanna are suddenly getting married, for example, which has only been hinted at in the series.
Upon investigation the crew discovers that they are not the "real" crew. They are duplicates, made of "bio-mimetic" material which Voyager had encountered last season. At that time a couple of the crewmen had been duplicated, causing some confusion. Eventually Voyager had departed the planet where this material existed, but not before it had mimicked Voyager and the entire crew. The imitation crew members were unaware of their artificial state and took on the motivations of the original crew, trying to head back for the Alpha quadrant and home. This had gone on for a year or two but now the bio-mimetic material was becoming unstable and starting to revert to its original form. In a short while, indications were that the material would become completely unstable.
It was a terrible shock to the crew to learn that they were not "real" but mere imitations. Some of them reacted with existentialist despair, considering lives to be futile and without purpose. Others focus on the practical problems that would arise if both they and the real crew were to make it back home. In the end the instability of the mimetic material forces them to turn back for their planet of origin.
On the way back they and the original Voyager cross paths. But just as the two ships detect each other on long range sensors, the imitation Voyager goes completely unstable and explodes into a structureless fog. The real Voyager crew never learns that they had duplicates who had existed on their own, with their own triumphs and failures, for over a year. The copies had made an attempt to launch a message buoy which would at least record their stories for posterity, but it failed and was destroyed with the rest of the ship.
Then, the fact that they ultimately fail, not only to make it back to their planet but to even get word out about themselves, was a terrible frustration. Their ship explodes mere seconds from making dramatic contact with the original voyager. What a disappointing ending.
I don't know who wrote this episode but it seemed to me to be contrary to the spirit of the Star Trek series. The only lessons you can learn from it are the opposite of what the writer seemed to intend.
Hal