Gary from Chicago’s feel-good story took a sick turn when it emerged Tuesday that the Oscars darling is a registered sex offender.

Gray Allan Coe became the toast of Tinseltown after he whooped it up with celebrities when his sightseeing bus tour stopped at the Dolby Theater during the 2017 Academy Awards Sunday night.

The 59-year-old Coe later told ABC-7 Chicago that he was released from prison just three days before his star turn after serving 20 years for multiple felonies.

It turns out that Coe was busted in 1975 for attempted rape, according to his lawyer Karen Nash.

'Gary from Chicago' was released from prison 3 days before Oscars

Nash was responding to a published report that said Coe was convicted of rape.

“He does not have a rape conviction. He served 20 years for petty theft,” Nash wrote on Facebook. “He has a prior from 1975 for attempted rape when he was a teenager.”

Nash added that it wasn’t uncommon for defendants with records to receive stiff sentences for minor crimes in the 1990s.

“Many great lawyers had clients get draconian sentences like that in the 90s,” wrote Nash, who petitioned for his release but didn’t represent him at trial. “There was little one could do during the 3 strikes era.”

‘Gary from Chicago’ is the big star of the Oscars

Coe, who was charged with attempted rape by force or fear, remains on California’s sex offender registry. Citing court records, Inside Edition reported that Coe knocked his victim to the ground, dragged her into the bushes and tried to rape her in Illinois.

But Nash said he served two decades in prison for the most mundane of crimes — stealing a bottle of $79 perfume.

“He actually got LIFE for petty theft, we got him out after he had served 20,” Nash wrote.

“Gary from Chicago” (pictured with actor Mahershala Ali) became the toast of Tinseltown when the tour bus he was on made a surprise stop at the Oscars. (ABC)

Records show he filed a petition in 2013 to be re-sentenced. He got a new sentence of six years in prison — time served — and was released on Thursday.

Coe entered Corcoran State Prison in October 1994 for grand theft exceeding $400 and was paroled in October 1996. He was hit with a three-strikes 25-year-to-life sentence in early 1997 when he was convicted of petty theft on New Year’s Eve 1996, according to the Los Angeles Times.

But Coe is now a reformed man committed to helping America’s youth steer clear of the criminal justice system, his lawyer said.

The revelations of Coe’s dark past emerged less than 48 hours after he nearly stole the show at the Oscars.

Coe was among a few dozen tourists who got off the double-decker bus and waltzed into the theater in the middle of the awards show.

“Gary from Chicago” also got to meet Octivia Spencer. (ABC)

Coe walked onstage carrying the purse of his fiancée, Vickie Vines, and went on to snap pictures with celebs. He even stopped to kiss the hands of Nicole Kidman, Halle Berry, Meryl Streep and Octavia Spencer.

Despite spending the past two decades in a California prison, Coe named Chicago as his hometown when he introduced himself to host Jimmy Kimmel.

“I feel like you’re ignoring the white celebrities,” Kimmel said to the bespectacled Coe.

“Yes I am, though,” he replied.

Coe and fiancée got the thrill of their lives when Denzel Washington performed a mock wedding ceremony.

Denzel Washington performed a mock wedding for “Gary from Chicago” and his fiancée Vickie Vines (left) during the Oscars. (ABC)

“I now pronounce you husband and wife,” the “Fences” star said. “Kiss the bride.”

In his interview with ABC-7 Chicago, Coe recalled the reaction of his son.

"You know what my son told me today, man? I almost come to tears. He said he's proud of me," Coe said. “So to hear your children say that they're proud of you, means the world to me.”

He met his fiancée while paying his “debt to society,” he said.