Sharon Shoesmith has won her Court of Appeal battle over her sacking following the Baby P tragedy.
Three judges allowed Ms Shoesmith's challenge against a High Court ruling that cleared former children's secretary Ed Balls and the local authority of acting unlawfully when she was dismissed as director of children's services at Haringey Council in north London.
Her appeal against regulator Ofsted was dismissed.
Her lawyers argued that she was the victim of "a flagrant breach of natural justice" as she was driven from her £133,000-a-year post by a media witchhunt and political pressure.
Ms Shoesmith, 58, was sacked in December 2008 after a damning Ofsted report exposed failings in her department as a result of the case of Baby P, now named as Peter Connelly.
She said after the hearing: "I'm over the moon. Absolutely thrilled."
Ms Shoesmith had asked Lord Neuberger, Master of the Rolls, sitting with Lord Justice Maurice Kay and Lord Justice Stanley Burnton, to rule that her sacking without compensation was so legally flawed as to be null and void, and that she still remains entitled to her full salary and pension from Haringey up to the present day.
The judges said they were allowing Ms Shoesmith's appeal against Mr Balls because "the secretary of state did not afford Ms Shoesmith the opportunity to put her case".
"In short, she was denied the elementary fairness which the law requires.
"We rejected a submission on behalf of the secretary of state that the situation was too urgent to permit the adoption of a fairer procedure.
"Nor did we feel able to accept that the adoption of a fair procedure would inevitably have led to the same outcome."
In the case of Haringey, the judges said: "We were unanimously of the view that Haringey's procedures were tainted by unfairness.
"Also two members of the court - the Master of the Rolls and Mr Justice Stanley Burnton - concluded that the unlawfulness of the secretary of state's decisions invalidated the decisions of Haringey to which they gave rise."
The judges said there were outstanding questions over the "remedy" which should be granted to Ms Shoesmith.
They said: "There is no question of her returning to her position. That is conceded on her behalf.
"However, there are issues concerning compensation following her dismissal without notice and without any payment in lieu of notice.
"We have not felt able to resolve this aspect of the case at the moment and consider it more appropriate to remit the case to the High Court for further consideration."
The judges emphasised that it was not for them "to express any view on whether Ms Shoesmith should or should not have been removed from office" or on the extent to which she was "blameworthy", if blameworthy at all.
"Our task has been the more limited one of deciding whether those whose decisions affected her (were) following procedures complying with the law's requirements of fairness."
Dismissing Ms Shoesmith's appeal over Ofsted, the judges said they had concluded that its damning report "complied with the requirements of statute and common law".
Ms Shoesmith said outside court: "I would love to go back to work (in Haringey) but that's not possible but I hope to carry on with my career with children in some capacity."
She said: "Having spent a lifetime protecting, caring (for) and educating children, my sorrow about the death of Peter Connelly in Haringey when I was director is something which will stay with me for the rest of my life.
"But as the judges have said, making a 'public sacrifice' of an individual will not prevent further tragedies."