Thanks for your response Looby. It is a bit of a long shot, I know. Her husband, John Patrick, was still alive in 1841, remarried. He was a shoemaker in Old Cumnock. This is the only Margaret Nicol I could find (using Scotlands People, ancestry, findmypast and other sources) who died in Ayrshire between 1831 and John's remarriage in 1841, and who fits. The date of this death is only a few weeks after the birth of her last (and ninth) child. It is possible she had gone to Troon to recuperate and probable that she had maternal relatives in the area.
Thanks again
Maryeliza