A Brooklyn man was busted for allegedly pistol-whipping two men and a woman with a stolen, loaded gun during a wild brawl outside an Irish pub in Midtown hours after Manhattan’s annual St. Patrick’s Day parade, law enforcement sources told The Post.

Thomas Hickey, 37, was arrested on charges of criminal possession of a weapon, assault and criminal possession of a controlled substance for the Saturday night incident at Mulligan’s Pub on Madison Avenue, sources said.

Cops were called to the pub around 7:40 p.m. and saw multiple people fighting with each other, including Hickey, who was wielding a loaded 9mm Smith & Wesson pistol in his right hand, sources told The Post.

The three victims – all in their 40s — told police that Hickey struck them in the head with the gun, causing them to suffer lacerations, according to sources.

Sources initially believed Hickey was an NYPD cop, but a department spokesman confirmed that is not the case.

Dramatic cellphone video obtained by The Post shows several people fighting on the street in front of the bar.

The five-minute clip begins with a man trying to storm into the pub and another man holding him back before the aggressor charges into the bar.

The man and others appear to then be ejected from the bar as the fight spills out onto the sidewalk.

Punches are thrown and the bystander filming the melee can be heard saying, “He got a gun! He got a gun! He got a gun!”

As the brawl continues in the street with cars passing by, a woman can be heard screaming, “Call the police! Call the police!”

Someone off-camera can be heard saying, “He’s punching girls in the face,” the footage reveals.

As the fighting carries on, the man filming says, “He’s pistol-whipping…He pistol-whipped him like eight times. He’s knocked out.”

Moments later, a swarm of police arrives on the scene and someone again screams, “He’s got a gun!”

The video shows one of the victims lying on his back in the street and not moving as a pal tries to console him saying, “Peter, are you with me?”

One of the victims, a 41-year-old Bronx man, told The Post Monday things happened so fast he needed the video of the incident – which he viewed on The Post’s website – to piece it all together.

“All I remembered, and I told the cops this, was seeing my friend’s face on the ground. I remember covering him up,” said the man, who asked to remain anonymous out of fear of retribution. “I don’t remember if I got hit while covering up, or I got hit during the fight, because it was very traumatic.”

The man suffered a gash on his face and a cut to the head that required staples and claims he “did not attack anybody” and was just defending those involved.

“I didn’t even know how this all began. I just ended up outside with the rest of the group, and then my friends were all getting attacked,” he said, adding that his sister got attacked by a gun.

Sources say a second suspect, identified as 37-year-old James Brady of Long Island, was also arrested on assault charges for punching and kicking the victims in the face during the melee.

The firearm that Hickey allegedly used to pistol-whip the victims had been reported stolen by Virginia’s Chesapeake City Police Department, according to sources.

Hickey has two prior arrests on his record — for gang assault in February 2003 and for criminal possession of marijuana in 1998, according to sources.

In March 2014, Brady was arrested on charges of aggravated unlicensed operator vehicle and burglary, sources said.

Hickey was taken to Bellevue Hospital Center for injuries he sustained during the brawl. The victims were also treated at the same hospital.

Additional reporting by Natalie Musumeci