Have you done any work on John Foley “father in law” in the 1851 census - if he is Margaret’s father that tells you her likely maiden name?
John Foley 'Als Cotter' is mentioned in the St. Patrick's RC church, Soho registers as being the father of Honor/Ann Foley.
She was christened on 6th December 1812. She was also the daughter of Catherine (Katherine) Farmor. This was gleaned from the Soc. Of Geneoaogists a number of years ago (about 1999).
John Foley and Catherine Farmer were married in 1811 again in St Patrick's RC church, Middlesex. John Foley is from Ireland so I suspect the trail will go cold from there.
I was trying to look at the problem from a different angle by seeing if there was a marriage between a William and Margaret resulting in a John birth.
Maybe they never married.
Were there other children as well as John and Mary?
Have you tried using not exact surname as it looks like one that could be written differently ie using the similar sounding option for a birth.
Yes many (allegedly):
John 1835/6/7 (on 1851 census)
Margaret 1835 (on 1851 census)
William 1840 (GRO found)
Thomas 1850 (GRO found)
I'm sure there must be more given the number of years between children.
You already know from the previous research that Ann(a) re-emerges as William’s wife from 1861 onwards. My theory, therefore:
“Margaret” never existed, and is an 1851 enumeration error for Ann(a) nee Foley. Perhaps the original household schedule was muddled and messy, and the name of the eldest daughter Margaret (possibly named after William’s mother) appeared to apply also to Ann(a).
This does seem likely. She was born as Honor and changed to Ann as well. She married as Ann and her death cert is also Ann.