Juan Catalan has been to many memorable games at Dodger Stadium. In the early 1980s, his Uncle Thomas took him to see Fernando Valenzuela pitch. Juan and his brother huddled in the cheap seats, passing binoculars back and forth as they marveled over the legendary Mexican player.

And when he was 18, Juan was sitting in the left-field pavilion when — in the bottom of the ninth inning — “a Joe Schmo from the Dodger bench” blasted a two-run homer. As it sailed into the stands, Juan was there to catch the ball.

But neither of those moments are as poignant as his May 12, 2003, outing to see his beloved Los Angeles Dodgers. His team lost 11-4 to the Atlanta Braves, but the game would help save his life.

“I wasn’t supposed to be at that game,” Juan, 39, told The Post. The then-24-year-old had snagged last-minute tickets from a client. “It gives me chills to think about.”

Three months later, Juan would be facing a murder rap. The slaying in question had taken place on May 12, the same night he was at Dodger Stadium — 20 miles from the crime.

Investigators didn’t buy his story.

As covered in the Netflix documentary “Long Shot,” out Friday, Juan’s innocence would ultimately rest on a near brush with fame — more specifically, with Larry David and “Curb Your Enthusiasm.”

On Aug. 12, 2003, Juan was driving from his home in the San Fernando Valley to work at his family’s machine shop.

As he pulled into the parking lot, a police SUV followed; by the time he opened the door, he had a gun to his head. Cops arrested him on the spot for the murder of 16-year-old Martha Puebla, who had recently testified at a preliminary hearing about a gang murder in which Juan’s brother Mario was charged as an accessory. (Mario was convicted and is currently serving time.) Authorities argued that Juan — who had been in the courtroom during the hearing — had killed Puebla in retaliation for cooperating with police.

An eyewitness to the execution-style murder identified him as the man who had pulled the trigger.

Juan, who had been arrested as a teen for breaking into cars, was in shock as he was booked and later moved to the Los Angeles County Men’s Central Jail.

“I felt like I was being framed,” he recalled.

The Dodgers fan had an alibi, having been at the stadium with his 6-year-old daughter, Melissa, his cousin and a friend on the night of the murder. But that wasn’t enough for the LAPD and the prosecutor — who had never lost a case and was going to push for the death penalty for Puebla’s murderer.

Juan remembered that “My cousin used to be a filing clerk at a [law] firm, and he would always go on and on about this kick-ass lawyer,” Todd Melnik. He frantically called the attorney, who agreed to be his defense lawyer.

“There’s always ways to find evidence that gets overlooked,” Melnik said. So he went to Dodger Stadium and pored over internal camera footage in hopes of finding any trace of his client. But the effort produced nothing.

Then Juan remembered that he had seen a camera crew filming in his section of the ballpark on the night in question. Melnik found out it was for HBO, and he went on a mission.

It turned out that comedian David had been shooting “The Carpool Lane” episode of “Curb,” in which he picks up a hooker so he can use the high-occupancy-vehicle lane to beat traffic to the Dodgers game.

“[At the time,] I had never even heard of Larry David or ‘Curb Your Enthusiasm,’ ” said Juan.

Show’ producers allowed Melnik to view their footage from that day. He sourced eight 10-minute tapes before finding his holy grail: Juan, in his No. 27 Kevin Brown shirt, and his young daughter walking to their seats after returning from the concession stand.

They had been stopped by a production assistant so as not to interrupt filming. But for some reason, the PA had a last-minute change of heart and let Juan and little Melissa walk to their seats — and into the background of the show’s action.

“Can you imagine had Melissa not asked for a snack?” Juan marveled.

As David himself says in the documentary of seeing Juan on tape, “There he was. Pretty cool.”

The discovery seemed a home run for Juan, who by then had been in jail over a month. Still, the prosecutor argued that the footage was from 9:10 p.m. — and the murder had occurred at 10:32. Juan ostensibly could have left early, driven to the scene of the crime, and still had time to kill Puebla.

He was back to square one.

But then the cellphone records came in — showing that Juan had picked up when his girlfriend rang him at 10:12 p.m. The call had pinged a tower near Dodger Stadium. He finally had a clean and clear alibi.

After sitting in jail for five and a half months, Juan was released when Judge Leslie Dunn dismissed the case at a preliminary hearing.

“I felt like the weight of the world [was] off my shoulders. I broke down,” Juan recalled of that day.

“If Juan had been home that night, he might be on death row right now,” said Melnik. “That’s how crazy this was. Only by happenstance did he get tickets to go to the game that night. Only by happenstance would [‘Curb’] be filming in his section that night.”

Juan was released, but couldn’t catch a break. Due to a clerical error, he had to report back to county jail two days later. The tombs had just been rocked by racial unrest after a murder inside, and Juan was actually afraid “I would be killed.”

Melnik had assumed it would be cleared up in 24 hours. Instead, Juan, a declared-innocent man, was there for two hell-filled weeks.

In 2007, Juan received $320,000 in a settlement of his civil lawsuit against the LAPD and the city of Los Angeles for false imprisonment, misconduct and defamation. (In 2008, gang member Raul Robledo received a life term for the murder.

‘I felt like the weight of the world [was] off my shoulders. I broke down’ - Juan Catalan

That same year, an HBO employee set it up so that Juan could finally meet David while the actor was working in Santa Monica, Calif.

“One of the producers said, ‘He’s a big germ guy, so don’t be offended if he doesn’t shake your hand,’ ” Juan recalled. “But as soon as we walked in, he extended his hand.”

Juan and his lawyer, Melnik, have become best friends, playing basketball and taking in Lakers and Dodgers games together.

Juan is also friendly with Judge Dunn, the woman who freed him. With her encouragement, the father of three earned his associate degree in general education. He still works at his family’s shop but hopes to get a four-year college degree and has applied to California State University, Northridge, to pursue a bachelor’s in business administration.

And, naturally, he’s now a big fan of “Curb your Enthusiasm.”

“That show is hilarious,” he said. “ ‘The Carpool Lane’ is obviously my favorite episode.”

He’s “eagerly awaiting” the new season of “Curb,” which premieres Oct. 1 on HBO.

Although Juan’s life has been forever changed by his experience, one thing remains the same: his love of the Dodgers.

“Baseball, to me, is part of life. Walking into that stadium . . . I feel at home. I am supposed to be there,” he said.

“The Dodgers are a part of me. People ask, ‘Why are you a fan?’ For one [thing], they saved my life.”