The Stour Valley Railway opened on 9 August 1865, linking near Cambridge with in Essex, with 13 intermediate stations along the line. The section between Shelford and 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 with frequency increasing slightly during peak hours. The last departure from Sudbury at the end of each day is extended to. There are plans to expand more services from Sudbury through to Colchester and using new bi-mode trains.
The line is single track throughout, has a loading gauge of W6, and a maximum speed of. Unlike other branches in the area, such as the Braintree branch line and Mayflower line to, the Gainsborough line is not electrified. New bi-mode trains started operating on the line in January 2020.
Stations
The following table summarises the line's four stations, their distance measured from, and estimated number of passenger entries/exits in 2018/19:
Station
Location
Local authority
Mileage
Patronage
Marks Tey
Borough of Colchester
46½
604,902
Chappel/Wakes Colne
Borough of Colchester
50¼
39,360
Bures
District of Braintree
53½
60,432
Sudbury
District of Babergh
58½
334,274
Accidents and incidents
On 12 July 1887 one person was killed at when part of a runaway train collided with a crossing gate.
On 27 January 2006 at least four passengers were slightly injured when a train ran into the buffer stop at. The 6:05 pm service from was travelling at a speed at the time of the collision of approximately six miles per hour. An investigation determined that the driver failed to apply the brakes in a "timely and appropriate manner".
On 17 August 2010 the Little Cornard derailment occurred when the 5:31 pm service from Sudbury collided with a lorry that had entered a level crossing without permission. The train driver and four passengers were seriously injured in the accident.