A former Legal Aid Society lawyer who helped secure the freedom of a pizza-delivering Ecuadorian immigrant detained by ICE is suing her ex-employers — claiming she was fired after requesting an investigation into an unethical boss.

Sarah Gillman, who narrowly helped Pablo Villavicencio avoid deportation, says in her Manhattan federal lawsuit that she was terminated in December 2018 after pointing out that the head of LAS’ immigration law unit, Jennifer Williams, had inappropriately inserted herself into Villavicencio’s case.

Gillman also claims Williams inserted herself into the personal life of Villavicencio’s wife, Sandra Chica.

The lawsuit claims Williams developed a friendship with Chica while she was actively engaged in Villavicencio’s case — advising Chica to divorce her husband and even hanging out after court.

“During the month of September and continuing into October 2018, on more than one occasion, Ms. Williams invited Sandra, her mother and her children—but not Pablo—to her home,” the suit says.

It got to the point where Williams even admitted she’d gotten too close, texting Gillman and Villavicencio’s co-counsel Gregory Copeland: “Best for me to step aside because I’m boxed into a corner between Sandra and Pedro.”

Yet Williams allegedly continued to involve herself and started harassing the lawyers and withholding information they needed for Villavicencio’s case.

At one point she even declared she was “team Sandra,” the court papers say, after Villavicencio was arrested for allegedly assaulting Chica.

Williams’ behavior drove Gillman to alert bosses via email that Williams was “unfit to hold her job.”

“She also complained about ‘the ethical violations’ relating to Ms. Williams’ relationship with Pablo’s wife Sandra and requested that ‘LAS conduct a full investigation and take the appropriate action,'” the lawsuit reads.

“The following day, on December 6, 2018, LAS terminated Ms. Gillman and Mr. Copeland’s employment.”

Gillman is suing for retaliation, violation of New York State Human Rights law, and other charges. She’s seeking unspecified damages.

Reached by phone, Gillman declined to comment.

“We believe the complaint is entirely without merit and we look forward to an opportunity to respond to it in court,” said a spokesman with the Legal Aid Society.