The Stour Valley Railway is a partially closed railway line that ran between Shelford, near Cambridge and Marks Tey in Essex, England. The line opened in sections between 1849 and 1865. The route from Shelford to Sudbury closed on 6 March 1967 leaving only the section from Sudbury to Marks Tey, known as the Gainsborough Line, in operation.
Following acts of Parliament in 1846 and 1847 the Colchester, Stour Valley, Sudbury & Halstead Railway was authorised to construct a line from Marks Tey to Sudbury and then extend from Sudbury to Clare, with a branch line to Bury St. Edmunds forking off at Long Melford. Before construction was completed the company had changed hands twice and became part of the Eastern Union Railway.
The Marks Tey to Sudbury section of the line opened on 2 July 1849 and ran for 5 years before being taken over by the Eastern Counties Railway on 7 August 1862.
In 1862 the Eastern Union Railway and Eastern Counties Railway were amalgamated into the new Great Eastern Railway.
After several years of protracted legal disputes, the Great Eastern Railway opened the section from Haverhill to Shelford on 1 June 1865 and then the section from Sudbury to Haverhil on 9 August. The Long Melford-Bury St Edmunds branch line from Melford to Bury St. Edmunds was also completed in the same year. The line was now connected to the Colne Valley and Halstead Railway at Haverhill serving Castle Hedingham, Halstead and Chappel and Wakes Colne.