(CNN)A 35-year-old man who spent almost 19 years wrongfully imprisoned for murder after detectives misled a witness into identifying the wrong person, is now free.
Sheldon Thomas, who was convicted of killing a 14-year-old boy on Christmas Eve in 2004 in New York City, had his conviction overturned and the indictment vacated Thursday -- years after an eyewitness identified him after being given a photo of the wrong Sheldon Thomas, according to a statement from Brooklyn District Attorney Eric Gonzales.
When the botched identification came out in court at the time, a judge said there was still probable cause for the arrest and that the photo had enough of a resemblance, Gonzalez said.
Thomas was only 17 when he was arrested and charged for the murder, records show.
His exoneration followed an extensive investigation by the Brooklyn DA's Conviction Reversal Unit, according to the DA's office.
Gonzales said the case against Thomas "was compromised from the very start by grave errors and lack of probable cause to arrest Mr. Thomas. He was further deprived of his due process rights when the prosecution proceeded even after the erroneous identification came to light, making his conviction fundamentally unfair."
"There's so many times when I was in my cell I would think of this moment," Thomas said in court Thursday. "Right now, I'm just speechless."
Thomas was one of three alleged gang members accused of killing teenager Anderson Bercy and wounding another person, according to the DA's office.
Detectives asked to use a photo of Thomas from a gun arrest months earlier so they could show an eyewitness as part of an array of photos, the DA's office said.
Before they obtained that photo, the detectives decided to pull a photo from a police database that was in fact of a different Sheldon Thomas, according to the office.
The eyewitness identified that photo in the array as the shooter, not knowing that it was the wrong Sheldon Thomas, according to Gonzales.
Detectives went to Thomas' address -- not that of the Sheldon Thomas whose photo was actually used -- and arrested him, according to a report from the DA's Conviction Reversal Unit. Two others were also arrested in connection with the killing.
That same eyewitness then identified Thomas in a police lineup, not knowing that the photo and the person she saw in the lineup were two different people, Gonzales said.
During a pretrial hearing in 2006, the detective on the case admitted during cross examination that he used a photo of the wrong Sheldon Thomas, admitting that he falsely testified, Gonzales said. Another detective then said Thomas told them he was not the man in the photo, according to the DA's office.
At that time, the judge said there was still probable cause because of the anonymous tips, adding that the photo resembled Thomas, despite it being of a different person.
Before the trial started, charges were dismissed against the other two arrested for the murder.
Thomas was found guilty of a slew of charges, including one count of second-degree murder, five counts of attempted murder and weapons charges. He was sentenced to 25 years to life.
When he was given the chance to speak before the sentence was handed down, Thomas stated one more time that he was innocent, according to the CRU report.
Years later, the Brooklyn DA's CRU re-interviewed the witnesses in the case in their own investigation, according to the DA's office.
They determined that Thomas was denied due process at every stage, making the conviction fundamentally unfair, according to the report. The CRU also determined that the detectives on the case repeatedly harassed Thomas after his gun arrest, which contradicted their testimony that they had never even seen Thomas, according to the DA's office. The report also pointed out "prosecutorial missteps, and counsel's failures."