Thomas Riker was created on the planet Nervala Four during an attempt to beam up William Riker in the narrow window that the planet's conditions allowed for transport. The transporter operator attempted to obtain a second transporter lock on Riker to ensure his safe retrieval, and the second transporter beam reflected back onto the planet, where "Thomas" Riker re-materialized. Thomas lived there for years, assuming that his shipmates thought him dead. He was rescued by the USS Enterprise, ironically by William Riker.
Unable to stomach serving on the same ship as his transporter double, he sought a position elsewhere in the Federation fleet.
Joining the Maquis
Disillusioned by his life in his own shadow, Thomas Riker eventually left Starfleet and joined the Maquis. As an exact duplicate of William Riker, his biometrics allowed him to penetrate the security around the USS Defiant at DS9. Once on board, he kidnapped Kira Nerys and faked a catastrophic system malfunction to steal the ship and take it into the Cardassian DMZ to attack a secret Obsidian Order shipyard. He was tracked down and captured by Gul Dukat and Benjamin Sisko, after which he was sent to a Cardassian prison, where he presumably died during the Dominion War.
Lieutenant William Riker was promoted for exceptional valor during the evacuation of Nervala Four. "Thomas" Riker, who performed exactly the same actions, did not receive such a promotion when he was discovered and rescued. This apparent prejudice against him may have influenced his decision to leave Starfleet.
Because of the nature of his creation, there is no sure way to really say which Riker is the true version of himself. This raises many questions as to the nature and ethics of using the transporter in the fashion that resulted in his duplication. How many times can a transporter pattern be duplicated before it's considered a different person? What real rights does Riker's double, who ever it really is, over the other?
- TNG "Second Chances"