This could be a possible connection.
Peter Hamilton (Baker) in the 1851 census has his place of birth as Lasswade.
The 1841 census for Lasswade had a Peter Hamilton aged 70 years. (Census rounded the years in some cases). There was a subsequent death of a Peter Hamilton aged 88 on 14th February 1855 in Lasswade (Bilston). The death registrations in 1855 had more information than today .
This Peter was born in Kirknewton and had lived 50 years in Lasswade. His parents were William Hamilton, Farmer and Agnes Cunningham. He was married to Jean McGregor and they had the following children:
Thomas 56 dec
56 (unclear so I have again attached this portion for others to decide - Janet?)
Alexander 55
James 53
William 49
Margaret 45
John 36 dec
Jane 40
Charles 38
Agnes 36
Peter 34
he was buried in Pentland and the death was advised by son Alexander.
The interesting and possible match is the age of son Peter which ties in correctly.
There was marriage between Peter Hamilton and Jane MacGregor in Mid Calder 2nd January 1796.
Looking further into the Hamiltons of Lasswade, I noticed a marriage between a Janet Hamilton and a William Hutchison in 1815 - which just happens to be the family that Peter (baker) was staying with in Browns Court, Edinburgh in 1851. One daughter Marion aged 12 and further investigation on Janet's death on 26th March 1877, 2 Roxburgh Street, Edinburgh, a widow aged 79 and daughter of Peter Hamilton, Road Surveyor and Jane McGregor, advised by her son-in-law George Burnett. (Married to Margaret Hutchison 27 November 1861). Confirmation.
If you would like the images which have been downloaded drop me a message.