The homeless man who fatally shoved a drunken Queens father in front of a Q train nearly five years ago was acquitted of all charges Monday.

“I’m thankful for my freedom,” crowed Naeem Davis, 34, after being cleared in Manhattan Supreme Court.

“I knew it would happen eventually,” he told reporters. “If you work and have a job and do the right thing, the law is going to work on your behalf.”

Davis’s acquittal came about a week after his lawyer, Stephen Pokart, told jurors that his client had acted in self-defense against a “deranged and threatening” man, Ki Suck Han.

A freelance Post photographer had captured the moment just before the Q train barreled into the station and crushed Han, an image that made the front page of the newspaper at the time.

Jury forewoman Gretchen Pfeil cried and hugged Davis, 34, as he walked out of court.

“For me, there was a lack of evidence on most of the charges,” she told reporters. “As a jury, I think, the vast majority of us from the beginning of our deliberations believed the prosecution had failed to prove that the defendant was not justified in his actions. And by the end of our deliberations, I believe we were of one mind that he was in fact justified in his actions or at least the prosecution had not convinced us otherwise.”

Pokart told jurors at the murder trial that Davis feared for his life after Han, 58, followed him into the 49th Street Station on Dec. 3, 2012.

“He was simply trying to defuse this combustible situation not brought about by him, but a man who was deranged and threatening,” said Pokart, who represented Davis along with Rachel Levy and Martin LaFalce of the Legal Aid Society.

Davis faced a potential life sentence in the case.

The jury, seven women and five men, began deliberating last Tuesday morning and announced their decision at noon Monday, finding Davis not guilty of second-degree murder, two counts of manslaughter and one count of criminally negligent homicide.

Assistant DA Charles Whitt had conceded that Han “staggering like a zombie, stumbling incoherently” but said that didn’t justify Davis’ extreme reaction.

Davis repeatedly asked Han to leave him alone as intoxicated dad pursued him down the 49th Street platform at about 12:20 p.m., witnesses testified during the three-week trial.

“I’m going to f—king kill you,” the inebriated straphanger growled at Davis, two witnesses testified.

Davis responded by pushing Han onto the tracks, which his lawyer argued was “rational and an act of self-defense.”

But prosecutors said Davis had become angered by the intrusive, annoying stranger and acted out of rage, not fear, when he used both his hands to propel the 5-foot-3, 122-pound onto the tracks.

“He [Han] went flying back, flying through the air,” said Whitt, who compared the violent act to tossing a “feeble old man” in front a train.

Davis coolly observed the gruesome scene, “listening to Mr. Han’s sternum and bones crack, [watching] the blood coming out of his mouth,” said the prosecutor, citing Davis’ own statements.

“What he did was heinous,” he added.

Afterward, Davis calmly picked up his cup of coffee and strolled out of the station to continue running errands for the Times Square vendors he worked for, Whitt said.

Davis said after the verdict that he’s “gonna go back home” to Paris, France.