The
Stour Valley Railway opened on 9 August 1865, linking near Cambridge with in Essex, with 13 intermediate stations along the line. The first section between and Marks Tey was opened as the Colchester, Stour Valley, Sudbury & Halstead Railway on 2 July 1849 and was taken over by the Eastern Counties Railway on 7 August 1862. The section between Shelford and Sudbury was closed on 6 March 1967 following the
Beeching cuts, leaving and as the only stops between the termini. In 2005 the line received around £3 million of investment, which saw around of old
jointed track replaced with new continuous welded rail. Further investment was made in 2006 to replace around of track, leaving just the
Chappel viaduct and Lamarsh to Sudbury sections in need of modernisation. This work was completed in 2007. In 2006 the line was designated as a
community railway by the transport minister and is part of the Essex and South Suffolk Community Rail Partnership. The current name of the line commemorates the painter
Thomas Gainsborough, who was born in Sudbury; the previous name was the Lovejoy line, after the television series
Lovejoy, which was filmed in the Sudbury area. All passenger services on the line are currently operated by
Greater Anglia, which runs an hourly service in each direction. The last departure from Sudbury at the end of each day is extended to . ==Notable sight==