NSW Premier Gladys Berejiklian has survived a no confidence vote brought on by Opposition Leader Jodi McKay, who accused her of turning a blind eye to corruption.
The no-confidence motion was defeated 47-38 in the lower house on Wednesday while the same motion was also defeated in the upper house, after a tied vote forced chair John Ajaka MLC to weigh in and cast the deciding negative vote.
"Decisions should not be taken except by majority, meaning that the chair should not be the reason a motion passes," Mr Ajaka said, explaining his vote.
The narrow escape came amid a rowdy day in the bear pit after Ms Berejikilian spent a third day battling to keep her job as her former boyfriend Daryl Maguire faced a grilling at the Independent Commission Against Corruption.
Ms McKay told parliament that while Ms Berejiklian was entitled to have a private life, her "close personal relationship" with the disgraced former Wagga Wagga MP was a "damning indictment on her ability to run a government".
"This is a premier who failed to act ... and turned a blind eye to wrongdoing," she told the NSW lower house on Wednesday.
"If we accept Gladys Berejiklian as premier we are saying the utterly unacceptable is OK. This motion is ... about the integrity of public office in NSW, the integrity of the office of the premier.
"If the premier stays, your government is forever diminished."
In response, NSW Treasurer Dominic Perrottet said Ms Berejiklian had demonstrated "complete honesty and integrity".
"There is no better leader in this country than Gladys Berejiklian," he said.
The premier continued to insist she had done nothing wrong.
Phone intercepts played at ICAC on Monday recounted numerous occasions in 2017 and 2018 in which Mr Maguire - who resigned from NSW parliament in 2018 in connection to a separate ICAC inquiry - discussed his business dealings with Ms Berejiklian.
Senior federal and state Liberal MPs on Tuesday rallied around Ms Berejiklian, who in parliament again insisted she had no inkling her ex-boyfriend's dealings may be dodgy and said she had been "full and frank" in giving evidence to the inquiry.
But Labor MPs heckled the premier as she told the parliament she had at all times acted with integrity.
"At any stage, had myself or any of my colleagues or the public servants who were in contact with him picked up that there was any wrongdoing, it would have been reported," Ms Berejilklian said.
"I bet there are times when you thought you could trust someone and you couldn't."
Giving evidence at ICAC on Wednesday, Mr Maguire admitted using his public office for personal profit, accepting deliveries of cash at his Parliament House office and secretly directing a company boasting its "influence reaches to high levels of government".
On oath he was asked if he had used his public offices between 2012 and 2018 "with a view to making money for yourself and ... your associates".
"Yes", he replied.
NSW Labor condemned the government for cutting short debate on the no-confidence motion with just two Labor speakers and two Liberals addressing the issue before the matter was put to a vote.
The premier left the chamber before debate began.