Pediatric trauma doctors squared off against the city’s medical examiner earlier this month in an unusual grand jury proceeding in Brooklyn that led to the controversial indictment of DWI cop Joseph Gray in the death of an unborn baby, sources told The Post.

Gray was arraigned on the new charges in Brooklyn Supreme Court yesterday as Maria Herrera’s immediate family looked on approvingly.

The case – which could pit city Medical Examiner Charles Hirsch against Brooklyn prosecutors at trial – has revived the legal and philosophical debate about when human life begins.

An 81/2-month pregnant Herrera, her son Andy, 4, and her sister Dilcia, 16, were killed after being run down by an allegedly drunk Gray.

Gray is facing 15 years in prison and is free on $50,000 bail.

The baby was delivered by Caesarean section soon after the crash. His tiny heart was jump-started with chemicals and beat for more than 12 hours while his breathing was supported by a respirator.

After 12 hours, doctors consulted with the family and decided the brain damage was sufficient to preclude any meaningful life, and pulled the plug, sources said yesterday.

Even then, sources said, the baby’s heart beat for another hour. But the city medical examiner, noting that chemicals were used to start the heart, declared the baby stillborn with no vital signs.

Under those circumstances, the baby is not legally considered a human being, and thus, cannot be the basis of a manslaughter charge.

In a dramatic grand jury session, pediatric trauma doctors from Columbia-Presbyterian Medical Center in upper Manhattan described their attempt to save the baby, posthumously named Ricardo Nicandol.

Columbia is a Level Three trauma center with the best pediatric trauma unit in the city. They were contacted by officials at Lutheran Hospital in Brooklyn in the hours after the accident.

A source told The Post the doctors “basically said they wouldn’t have gone to those lengths for a corpse.”

The grand jury apparently sided with the doctors, and charged Gray with second-degree manslaughter and vehicular manslaughter earlier.

The new charge makes no difference from a punitive standpoint. Gray still only faces a maxi^^^^^^^^^^^^^^^^^^^^^^^^^mum of 15 years in prison.