Hi Mags49 and welcome to Rootschat.
The couple marry on 5th September 1840 at Ayr ( as you will know but I'm posting the info for the benefit of other Rootschatters)
Where was Margaret and Adam on the 1851 Census, please? Or was Margaret already recorded as a widow at this time.
You mention 4 children to the couple -
please can we have their full names, including any middle names, their years of birth and the parish their births/baptisms are registered in.
All this might help us move your search forward.
Best
Looby