I have come across a bapt (once) where the child was not recorded as illegitimate, but the parents were later proved to have been unmarried. They had the child bapt in a different parish where they were (apparently) not known, but this is unusual.
However if Robert can't be found elsewhere in early censuses, and appears to be with his Gilmour grandparents in 1851 and 1861 as Carol wrote, that could be the answer. The grandparent probably gave his name as Cunningham because that was his daughter's name at that time.
- I just had a look at the 1851 scan, and Mary Cunningham, daur, aged 26, is also in the household with other siblings, so Robt Cunningham 4 grandson b.Douglas and Thos (ditto) 11 mths grandson b.Marown are probably under Cunningham to identify them as Mary's children near the end of the list in a household of Gilmores.
In 1861 Marown, Trollaby? Cottage, with the grandparents Daniel Gilmour, 67, formerly ag. lab., b.Ireland and wife Isabella 64 b.German, are Robert Spenston 14 ag. lab., b. Douglas, Thomas Cunningham 10 b.Marown, with other members of the Gilmour family, but Mary not there.
I still think it would be a good idea to look at his bapt and marriage details as suggested previously.
Sue