It was yet another lucky break for this privileged son.

The scion of a well-connected Big Apple family filled with lawyers, bankers and politicians skated on 11 drug charges after he pointed a gun at cops last year — all because investigators flubbed a search warrant, The Post has learned.

Patrick Allen — the son of former Brooklyn prosecutors, grandson of a judge and great-grandson of longtime Post publisher Dorothy Schiff — was busted alongside pal Jonathan Derbyshire for shooting illegal guns in a wooded area of Staten Island at 1 a.m. on Jan. 5, 2017.

When cops showed up, Allen allegedly aimed a pistol at police, who opened fire, striking the rich kid five times. Derbyshire turned himself over to police after a brief chase and eventually cut a plea deal.

Allen still faces 12 charges for weapons possession, reckless endangerment, menacing and unlawfully wearing a bulletproof vest, court records show.

Following the arrests, an “accomplice” of Allen’s admitted to cops that there were drugs stashed at a house nearby on Kreischer Street, according to court papers.

Cops got a warrant and raided the place later that day, allegedly hauling out 6 ounces of marijuana and more than 2,000 Xanax and oxycodone pills.

And so they slapped Allen with 11 drug-related charges — all of which were dropped months later, because detectives screwed up a small but important detail on the warrant application.

Det. Giovanni Talavera of the Force Investigation Division swore in a warrant application written by ADA Melissa O’Leary that the Kreischer Street address was a “single-family home” — but the home actually had two units, and that makes enough of a difference to invalidate the warrant, according to Allen’s lawyer Jay Goldberg.

“Either Det. Talavera or ADA O’Leary, or both, intentionally or recklessly misled the issuing judge as to the nature of the premises to be searched,” Goldberg wrote in filings obtained by The Post.

“…[T]he warrant did not sufficiently describe the premises to be searched and the warrant should be controverted and all evidence seized be suppressed.”

Prosecutors argued they used the best information they had to obtain the warrant, but Judge Mario Mattei ultimately dismissed the drug charges — with prosecutors’ consent — on Nov. 28, 2017, according to multiple sources familiar with the case.

Allen is due back in court Sept. 5 for the gun-related charges.

Goldberg declined to comment. Messages left with Talavera, O’Leary and Allen were not returned. Neither the NYPD nor the Staten Island DA’s office responded to requests for comment.

Additional reporting by Kevin Sheehan