The Melbourne and Suburban Railway Company opened a line from Princes Bridge railway station to Punt Road (Richmond) and South Yarra in 1859 and extended to Dandenong in 1879. The South Gippsland railway line (also known as the Great Southern Railway) was opened from Dandenong to Cranbourne in 1888 and extended to Koo Wee Rup, Nyora and Loch in 1890, Korumburra and Leongatha in 1891 and Welshpool, Alberton and Port Albert in 1892. The section from Alberton to Port Albert was closed in the 1940s. A branch line was built from Alberton to Yarram and Woodside in 1921.
The line was well known for its sharp curves and spectacular scenery and was also one of the last lines to offer a 'Mixed Passenger and Goods' service in Victoria. The section from Yarram to Woodside was closed on 26 May 1953, with the section from Welshpool to Yarram closed on 26 October 1987 when the superphosphate freight services ceased. From this point until 30 June 1992, the track beyond Agnes, referred to as Barry Beach Junction received minimal usage, although a short branch leading from Agnes to Barry Beach was used extensively for goods traffic to serve the oil platforms in Bass Strait. After the withdrawal of this freight service the railway line beyond Leongatha would be closed. This section of track was then dismantled in 1994, in which required the strengthening of the line's derilcit trestle bridges in order to allow the track removal machine to dismantle the tracks.
On 24 July 1993, the last regular V/Line passenger train operated to Leongatha with P Class diesel locomotive number 18 hauling the return passenger train with a set of 4 H-Set carriages. Following the withdrawal of all rail service beyond Koala Siding, the section of track from Nyora to Leongatha was transferred to the South Gippsland Railway in 1994, The South Gippsland Railway was founded in 1990 as the "Great Southern Railway Society", based at Nyora, with the intention of preserving the line in case of closure. On 15 January 1998, all regular V/Line services ceased on the line after the withdrawal of the Australian Glass Manufacturing sand train, that operated between the sand mine at Koala Siding, situated between Lang Lang and Nyora railway stations, and the AGM siding at Spotswood. Since April 1998, no trains have operated beyond Cranbourne.
A 5 km-long narrow-gauge horse-drawn tramway was opened from Welshpool to Welshpool Jetty in 1905. It was closed in 1941.
The mountainous Strzelecki branch line, which opened in 1922, was built from Koo Wee Rup to Strzelecki. The line was closed in stages throughout the 1930s, '40s and '50s.
The Wonthaggi branch line was built from Nyora to Wonthaggi, opening in 1910, to serve the State Coal Mine, a small extension to the line was opened in 1917. The Wonthaggi line was closed in 1978.
The Outtrim branch line was built from Korumburra to the coal mine at Outtrim in two stages: the initial stage to Jumbunna was opened in 1894, with the final section to Outtrim opening in 1896. The line was closed in two stages: the first from Jumbunna to Outtrim on 4 September 1951 and then from Jumbunna to Korumburra on 1 October 1953.
Passenger services operated on the line from its opening. Services from Melbourne to Leongatha and Yarram were withdrawn on 6 June 1981, with replacement buses starting three days later. The Yarram train was a loco hauled train, while the Leongatha train was a DRC railcar hauling MTH carriages. To fill the gaps between those services, local trains were introduced on a three-month trial from Dandenong to Lang Lang, but were withdrawn on 3 October 1981, due to insufficient patronage. Services to Leongatha were restored on 9 December 1984, and free train shuttles to Korumburra were provided to mark the occasion. The 1984 timetable included two round trips per day from Monday to Saturday, and one round trip on Sundays. However, the services were again withdrawn on 24 July 1993. With the withdrawal of freight services from Koala siding in January 1998, the line became unused beyond Cranbourne. The exception was a tourist operation, which commenced operation between Nyora and Leongatha. It later became known as South Gippsland Railway . In 1995 the section between Dandenong and Cranbourne was electrified and a station added at Merinda Park, as part of a $27 million Federal Government-funded project.
The Barry Beach freight service ceased in 1992, which ended all traffic on the line beyond Leongatha. V/Line passenger services ceased to Leongatha on 24 July 1993, after last train to Melbourne. By the mid-1990s only T, Y and P class diesel locomotives were used on the line, due to their low axle loads, with a 15 km/h speed limit applying to parts of the track. This continued until 15 January 1998, when the Koala Siding (near Nyora) to Spotswood sand train ceased operation. On average, it took a passenger train 2 hours and 15 minutes to travel from Spencer Street Station to Leongatha during the final 10 years of service, with the replacement bus service completing the journey in an average time of 2 hours and 30 minutes.
A number of special railway enthusiast services were operated along the line during the 1980s and 1990s, given that the line was near closure. Notable special journeys included K.153 hauling the last steam special to Yarram on 24 October 1987, as well as an earlier Vintage Train journey to Foster and return on 6 September 1987. The last steam hauled train to run beyond Leongatha was on 13 November 1988, when steam locomotives D3.639 and K.153 travelled to Foster. That was the last time the locomotive turntable at Foster would be available for usage prior to its relocation to Korumburra railway station for the South Gippsland Tourist Railway in 1994. Local Melbourne community groups continued to organise chartered special diesel and railcar-hauled trains beyond Leongatha until 1991. A steam and diesel special to Barry Beach and Welshpool on 11 November 1989, which was organised to celebrate the 100th anniversary since the Dandenong to Nyora section of the Great Southern Railway Line opened. Heritage steam locomotive J515 hauled the special to Leongatha and return later one in the day while then V/Line diesel locomotive T368 took over for the section of track beyond Leongatha due to the turntable at Foster not being available for operation. D.E.R.M. 58 ran the last advertised special train available to the public beyond Leongatha to Welshpool and Barry Beach on May the 12th 1990.
During the 1990s, steam tours only operated as far as Leongatha, with the first being run on 9 September 1990, again hauled by steam locomotive K.153, which coincided with the steam locomotive's 50th anniversary since being introduced into service. In 1993 there were two notable steam -hauled trips to Leongatha. Both specials were operated by Steamrail Victoria, and hauled 11-car consists of Victorian Railways E-Type and W-Type wooden carriages, which ran numerous shuttles between Korumburra and Leongatha stations. The first one was on 2 May, which was supposed to be a triple header of K Class steam locomotives. However, one of the scheduled locomotives, K190, suffered a defective main internal steampipe failure at Caulfield, leaving locomotives K153 and K183 to double-head the train. On 25 July 1993, the apparent "Last Lament to Leongatha" was run, operated by K190 and K183.
After the withdrawal of passenger services to Leongatha, a few more steam-hauled trips were organised before the line was booked out of regular use between Cranbourne and Nyora. On 17 April 1994, K190 and K183 again travelled to Leongatha with the "South Gippsland Rambler", with a consist of seven wooden carriages. Steam locomotive J515 journeyed to Leongatha on 14 October 1995, for the first time since November 1989, organised by the Seymour Railway Heritage Centre and the ARHS. During the tour, J515 derailed due to a missing guide rail on the locomotive turntable at Korumburra that had been recently relocated from Foster.
The last locomotive to traverse the South Gippsland main line before its closure was steam locomotive K190 operated by Steamrail Victoria. It returned to Steamrail Victoria's base at Newport on 29 April 1998, after it was leased to the South Gippsland Tourist Railway (SGTR) in December 1996. The South Gippsland Tourist Railway had first loaned the locomotive during the summer of 1995-1996. The locomotive again returned for the summer of 1996-1997. K190 was leased to the South Gippsland Tourist Railway on 7 December 1996, when Steamrail Victoria operated another steam special to Leongatha. Diesel loco T345 was also loaned to the tourist railway at the time, and was part of the train from Newport workshops. K183 double-headed with K190 to Nyora, with T345 attached to the special. K190 and T345 were detached at Nyora station. Shortly afterwards K183 journeyed solo to Leongatha. K190 followed to Leongatha with a consist of the tourist railway's carriages. T342, T345 and the DERM RM55 combined for a Saturday tourist railway service. Later, K183 returned to Newport Workshops with the Steamrail Victoria train. However, steam locomotives D3639 and K183 combined for the last steam excursion to traverse the South Gippsland rail line on 25 September 1997. During this time D3639, along with K190, were both on loan to the South Gippsland Tourist Railway.
The track beyond Leongatha, to Yarram and the Barry Beach branch line, was dismantled in 1994, but removal of other infrastructure, such as level crossing signals, took place around mid to late 1992, soon after the last train ran to Barry Beach. The section between Leongatha and Foster was turned into the Great Southern Rail Trail in 1998. In 2011, the Tarra Rail Trail from Alberton to Yarram was completed. As of September 2013, the section between Foster and Toora had been complete, leaving the final section from there to Alberton being converted into the Great Southern Rail Trail.
The section from Dandenong to Cranbourne was electrified in 1995 and, as the Cranbourne Line, is now part of the Melbourne suburban rail network. The first level crossing on the closed section of the line, the South Gippsland Highway crossing in Cranbourne has since been paved over. The Victorian Transport Plan of 2009 stated that the Cranbourne line would be extended two kilometres to a new station at Cranbourne East by 2015. The new Cranbourne East station would be built near Renyard Street and the Casey Fields complex. The line from Nyora to Leongatha was used by the South Gippsland Tourist Railway until 2016. The branch line from Nyora to Wonthaggi was closed in 1978 and dismantled by 1990. It is now the Bass Coast Rail Trail. Since its closure, a significant section of the former Wonthaggi Line has been leased or sold to farmers, while other sections have been cut away to widen highways and main roads in the coastal South Gippsland region. The former branch lines to both Outtrim and Strezlecki have become a distant memory.
The remaining section of track from Cranbourne to Nyora is disused but mostly still intact. A length of track was pulled up at Koo Wee Rup in 2009 to allow the construction of toilets for the bus and coach stop. Construction of the pipeline for Wonthaggi Desalination Plant made it necessary to remove three sections of the line. The first is about 100 metres on the down side of Monomeith Road, where about 50 metres of track were removed. The second is on the up side of Caldermeade Road, where about thirty metres of track were removed, and the third is about halfway between Caldermeade and Lang Lang stations.
Much of the operational and safeworking infrastructure remains in place in this section, including signalling equipment, level crossings, and easements. Station platforms are also in place, but mostly without station buildings, for example at Lang Lang, Koo-Wee-Rup, and Tooradin. Parts of the track have warped due to erosion, ground movement or the displacement of sleepers. This is especially evident near Lang Lang, Tooradin, and north of Koo-Wee-Rup. There are also questions about the integrity of some bridges and culverts along the route.
Prior to the 1999 Victorian election, the state Labor Party promised to return passenger services to Leongatha. In 2008, a report commissioned by the Victorian Department of Transport found the cost of returning passenger services to Leongatha to be unjustifiably high, estimating the cost at $72 million. The report stated that only 20 per cent of respondents surveyed about their transport needs considered restoring train services to be the main priority. Instead $14.7 million was allocated to road coach service upgrades. The then Minister for Public Transport Lynne Kosky said that the State Government had provided funding for development of a rail trail between Cranbourne East and Nyora to support tourism in South Gippsland in May 2008.
On February 24, 2016 South Gippsland Shire Council unanimously carried motions to support the return of rail services to Leongatha on the back of a petition initiated by the South & West Gippsland Transport Group, which attracted 2,420 supporters. The successful motion means that the data gathered from the petition and documents prepared by South Gippsland Shire Council investigating the returning rail to South Gippsland have now been passed onto Public Transport Victoria with a call to provide for South Gippsland rail services in the forthcoming Regional Network Development Plan. After the disbandment of the South Gippsland Tourist Railway on January 16, 2016 it had also been announced that VicTrack will continue to leave the disused rail line between Cranbourne and Leongatha intact and available for future use by freight and passenger trains.
Reopening the South Gippsland railway line as far as Leongatha continues to be prominent issue in the region. A South Gippsland Shire Council Priority Projects document, released in June 2013, acknowledged that the return of a rail service was a major community priority, with funding and support sought from all levels of government. In early 2014, a report into possible extensions of the Melbourne metropolitan rail system identified the population growth corridor from Cranbourne to Koo-Wee-Rup, along the disused Leongatha line, as a key planning priority. The South and West Gippsland Transport Group, a public transport and rail lobby group, established in April 2011, which is closely associated with the South Gippsland Shire Council and other local government bodies, has campaigned for an integrated transport plan in the region, which includes rail at the forefront of the proposal. The group had been known as the South Gippsland Transport Users Group and had amalgamated with numerous rail lobby groups in 1994 shortly after the rail passenger service to Leongatha was withdrawn in July 1993. One notable milestone for the group was running a successful campaign that saw passenger rail services reinstated to Leongatha on December 9, 1984. Despite the promise to revive the railway line for freight and passenger services by the Bracks Labor government in 1999 being abandoned by his successor John Brumby in 2008, a community campaign involving the South and West Gippsland Transport Group continued to lobby, in collaboration with key stakeholders and governments, to achieve the reinstatement of rail services, and the improvement of transport accessibility in the region.