The New York Times journalist whose secret affair with former Oasis frontman Liam Gallagher resulted in a baby girl rushed to Manhattan Supreme Court on Wednesday to file a custody petition against her famous ex.

Freelance writer Liza Ghorbani tried to keep her lawsuit out of the public eye by filing it among multiple, confidential cases that land in the busy lower Manhattan courthouse every day, a clerk told The Post’s Julia Marsh.

The case is sealed, but it comes on the heels of a $3 million child support case Ghorbani had brought against the married Gallagher in ­Manhattan Family Court. Page Six exclusively reported the affair and the birth of their ­daughter, plus the ensuing legal battle, in July.

Seasoned family law attorney Martha Cohen Stine, who’s not involved in the case, speculated that Ghorbani jumped venues from family to supreme court because some litigants see the latter as having more sophisticated judges who regularly handle high-profile divorce cases. Ghorbani is suing for full custody and child support.

The product of the writer’s tryst with the rocker, whom she profiled for the New York Times in 2010 in the aptly headlined story “A Night Out With Liam Gallagher,” is their now 11-month-old Gemma.

The tot has been living with her mother in New York, but Stine speculated that Ghorbani may have filed for custody if Gallagher had started making demands to visit with their child. It is not clear if he has even seen Gemma since she was born.

Lawyers for Gallagher and Ghorbani did not immediately return calls for comment.

Gallagher split with his wife of five years, former “All Saints” singer Nicole Appleton, after she discovered he had fathered a child with Ghorbani.

According to British reports, he has been spending time with his former personal assistant Debbie Gwyther and lives in London just five minutes away from the home he shared with ­Appleton.