It was the shot heard ’round the sports world.

The most famous logo in sports has its roots in an unlikely event: a 19th-century shooting.

Police Officer John McDowell was on routine patrol in Hell’s Kitchen in the early-morning hours of Jan. 8, 1877, when he spotted a burglary in progress at Courtney’s Liquor Store.

McDowell attempted to arrest the thieves, took a bullet in the left ear for his trouble — but still managed to hold on to one of the goons, George Flint.

As explained in the new history “Pinstripe Empire: The New York Yankees from Before the Babe to After the Boss” (Bloomsbury) by Marty Appel, McDowell eventually recovered from his wounds, and the brave cop was awarded a Tiffany & Co.-designed NYPD Medal of Valor, featuring the now-famous interlocking “NY.”

How the iconic symbol made its way to the caps and uniforms of the New York Yankees is still a matter of conjecture, according to Bill Francis, a senior researcher at the National Baseball Hall of Fame Library.

From the team’s inception as the Highlanders (they played at Hilltop Park in northern Manhattan, one of the borough’s highest points) in 1903, the squad wore uniforms with an “N” or a “Y” somewhere on their jersey.

But it wasn’t until 1909 that the “NY” appeared on the uniform’s left sleeve and ball cap.

Francis said the prevailing theory is that Yankees owner William “Big Bill” Devery — a New York City police chief in 1898 — was behind it, though no direct link is known.

And interlocking letters were not uncommon on baseball uniforms. The “NY” was introduced on Yankees caps and sleeves a year after it appeared on New York Giants uniforms, noted Tony Morante, the Yankees director of stadium tours for the past 39 years.

A Tiffany’s spokesman said the logo was created at a time when meticulous records were not kept, so the company could not provide details about its relationship with the Yankees. The company now makes MLB’s commissioner’s trophy.

The logo left the jerseys in 1916, but returned in 1936. “It may have been because owner Jacob Ruppert wanted to see his players more nattily dressed,” explained Morante, 70.

The success of the Yankees — 27 World Series titles — helped build the brand.

“People wanted to identify with the Yankees,” said Morante.

Francis agreed: “It’s known around the world.”

And fans are eager to pay to look the part. The team’s brand raked in $363 million last year in merchandise sales — tops in sports, according to Forbes. The team has no plans to tinker with its past, or its future.

“We’re not trying to reinvent the wheel,” said team spokesman Jason Zillo.

The medal has a home due south of The Bronx; it’s housed at the New York City Police Museum in Lower Manhattan.