Hi again,
Going with the info supplied by Ciderdrinker, I wonder if this could be Margaret's second marriage
https://familysearch.org/pal:/MM9.1.1/XTYF-SJ8Margaret Burnet Robb to James
Robertson at Central District Glasgow on 5 Oct 1855.
Well worth looking on Scotlands People for that one MGM.
Found on Freecen-
1851 Census at Gadgirth Holme, Colyton Ayrshire-
Robb Peter Head M M 57 Gardener (Master Emp None) Angus - Dundee
Robb Marion Wife M F 50 Housekeeper Angus - Dundee
Robb Margaret Dau U F 24 Employed At Home Ayrshire - Coylton
Robb Kinnaird Son U M 15 Scholar Ayrshire - Coylton
Robb Helen Dau U F 12 Scholar Ayrshire - Coylton
Wallace John Grnson U M 3 Lanarkshire - - Altered from RFW Glasgow
This look like Margaret and the illegitmate son referred to by Ciderdrinker. She must still have to marry Andrew Gray (if indeed she did

)
And here is young Andrew Gray living in the same area on the 1851 Census.
Gadgirthe Holme , Coylton.
Stewart Archibald Head M M 38 Joiner (Emp 2 Appren) Bute - Arran
Stewart Mary Wife M F 34 Housekeeper Ayrshire - Craigie
Stewart Agnes Dau U F 10 Scholar Ayrshire - Coylton
Stewart Mary Dau U F 8 Scholar Ayrshire - Coylton
Stewart Margaret Dau U F 4 Ayrshire - Coylton
Stewart Elisabeth Dau U F 2 Ayrshire - Coylton
Thomson Janet Servnt U F 17 House Servant Dumfries-shire - Kirkconnel
Gray Andrew Servnt U M 20 Joiners (Apprentice) Ayrshire - Dailly
Hay William Servnt U M 17 Joiners (Apprentice) Ayrshire - Tarbolton
The date of 1842 for Andrew leaving for America and dying at sea must be incorrect. Perhaps 1852?
Looby