The only William Goudie born around 1862 in Ayr seems to be the illegitimate son of Janet Goudie. Have you checked this birth on SP Dennis? I wondered if her mother's name was given as her maiden name When william married.
Then I found this marriage -
WILLIAM GOUDIE
Spouse: JANET MCCOSKRIE
Marriage: 12 DEC 1829 Ayr, Ayr, Scotland
Pretty sure this is her in 1841-
Piece: SCT1851/612 Place: St. Quivox -Ayrshire Enumeration District: 7f
Civil Parish: St. Quivox Ecclesiastical Parish, Village or Island: Wallacetown
Folio: 0 Page: 9 Schedule: 39
Address: Wallace Street, Wallacetown
Surname First name(s) Rel Status Sex Age Occupation Where Born Remarks
GOUDIE Janet Head W F 41 Hand Sewer Ayrshire - Ayr
GOUDIE Sarah Dau U F 18 Hand Sewer Ayrshire - Ayr
GOUDIE Ann Dau U F 16 Hand Sewer Ayrshire - Ayr
GOUDIE Janet Dau U F 12 Hand Sewer Ayrshire - Ayr
GOUDIE Isabella Dau - F 7 Scholar Ayrshire - Ayr
There are 3 other illegitimate children, Annabella, Peter and John, born to a Janet Goudie.
In 1871 she is living with her 2 sons Peter and John. Annabella is with her gran.
Unfortunately the biggest hole in my theory is that there is no William living with her or the gran in 1871. Or maybe I have the wrong family completely.
Anyway better get to bed.
Kind regards,
Annette
PS
That Janet Goudie is still living in Ayr in 1881.
Dwelling: 59 Cross St
Census Place: St Quivox, Ayr, Scotland
Source: FHL Film 0203590 GRO Ref Volume 578 EnumDist 22 Page 26
Marr Age Sex Birthplace
Janet GOUDIE U 40 F St Quivox, Ayr, Scotland
Rel: Head
Occ: Sewer
Peter GOUDIE U 15 M St Quivox, Ayr, Scotland
Rel: Son
Occ: Apprentice Painter
Mary MC DONALD U 40 F Maybole, Ayr, Scotland
Rel: Lodger
Occ: Mill Worker