The country's most senior family court judge, Sir Mark Potter, decided that a man who brought up the boy believing him to be his own child was entitled to parental rights too - even though he turned out not be the father.
The court ruled in the man's favour, despite the mother's plea that he will use his role as a father "in an officious and controlling manner, productive of strife rather than harmony".
The boy was born in 2002 soon after the couple formed their relationship and the man - referred to only as "Mr A" - believed he was the father.
He cut the umbilical cord and "was involved as a father from the start," the President of the Family Division, Sir Mark Potter, told the court.
The boy, identified only by the initial "H" in today's ruling, was brought up "on the assumption that Mr A was his biological father".
It was only after they broke up in 2004 that the mother told him that the boy, then aged two, might not be his.
DNA testing later proved the true father was a man with whom the mother had a relationship very shortly before she met Mr A and with whom she had had sex during the same menstrual cycle.
Even after the relationship broke down, the former couple carried on living under the same roof for a time.
But she moved out with the boy after discovering a cache of videos Mr A had covertly shot of her and her son, using a network of hidden cameras in their private quarters, and carefully marked with the date and time of recording.
At the Appeal Court, the mother, aged in her 40s, argued Mr A's underhand behaviour revealed his "dominant and controlling personality".
She told the court she had been "overwhelmed" by his never-ending attempts to get his own way and gain full parental rights over her son.
Her ambitions to move away from Mr A, aged in his 50s, and start a new life on the south coast had been thwarted by him at every turn, her barrister, Kate Branigan QC, told the court.
However, a judge at Bath County Court in January this year awarded Mr A parental rights over the boy, along with a joint residence order, effectively giving him equal rights over the child as his natural mother.
At the Appeal Court, the lawyer attacked the county court ruling, claiming the judge had been overly critical of the mother and reached a decision which "undermined her position as a biological mother".
However, dismissing the appeal, Sir Mark Potter said Mr A had played a full part in the boy's early life and had a "genuine and legitimate ambition" to continue to play a father's role.