Maybe worth looking at the 1861 Census to see if that John ANDERSON is a widower?
Searching SP free Index search:
There is a death registration:
Jane ANDERSON, other name HAIR
Died in Lanarkshire in 1864, age 39 (b abt 1825), Registered in Glasgow.
May or may not be Mary's mother - and you can't tell from the Index which surname is the maiden name

In 1871, at 85 Garnethill St, in Blythswood, Glasgow, Lanarkshire - there is:
Head: John ANDERSON 48, Coachman, b Ayrshire
Wife: Helen ANDERSON 32, b Lanarkshire
Son: Robert B ANDERSON 14, Brass Finisher, b Lanarkshire
Plus 3 boarders: PHILLIPS (b Fife), WRIGHT (b Clackmannan) and BOWES (b Berkshire)
If we could find that family on another census......?
Also in Glasgow St Paul is a John ANDERSON age 50, b abt 1821 Beith, Ayrshire. He's a waiter.
Also, an Elimination, in case it comes up:A John ANDERSON & Jane HARE married 8 Aug 1846, Newbattle, Midlothian
This couple had issue: Andrew born 1847 and an Esther in 1850.
They are all together in 1851 in Newbattle - and this Jane ANDERSON other surname HARE is 39 (born abt 1812) and her husband is a Coalminer. In 1861 Jane is still in Newbattle with the 2 children, possibly widowed.
Cheers
AMBLY