Hereford, Hay and Brecon Railway blank share receipt undated
The Railway Mania of the 1840s saw several schemes for trunk railways through parts of the Wye Valley. No construction took place however until the Hereford, Hay & Brecon Railway obtained an act on 8 August 1859 to build a railway from a junction with the Shrewsbury & Hereford Railway at Hereford, via Bronllys to a temporary terminus to the north of Brecon, and from there extensions to Swansea and Milford Haven were planned.
An initial agreement was made with the Oxford, Worcester & Wolverhampton Railway and Worcester & Hereford Railway to work the HH&BR as soon as 20 were open, but boardroom disputes caused these to be repudiated. The HH&BR amended its act which now permitted a junction with the Newport, Abergavenny & Hereford Railway and use of its Barton station in Hereford.
On 6 November 1859 the HH&BR purchased the Hay Tramroad as an alternative route to Brecon. Following objections by the Brecon & Merthyr Railway and Mid Wales Railway the act of purchase was amended in 1861, to allow the B&MR to acquire the Hay Tramroad between Talyllyn Junction and Brecon and the Mid Wales Railway the section between Talyllyn Junction, and a junction with the HH&BR at Aberllynfi, which was known as Three Cocks Junction after the near by Inn. Both the HH&BR and MWR had unrestricted running powers into Brecon. The HH&BR opened in stages from Hereford reaching Moorhampton on 24 October 1862, Eardisley on 30 June 1863, Hay on 11th July 1864 and Three Cocks on 19th September 1864 when through running to Brecon commenced.
The HH&BR and B&MR agreed to amalgamate from 25 August 1865, but in 1868 it was discovered that the preference shareholders of the B&MR had not ratified the agreement, which was accordingly declared illegal by the Court of Chancery. The HH&BR after a period of receivership from 13 July 1868, was reincorporated on 26 July 1869. The B&MR ceased to work the HH&BR from 30 September 1868, when a temporary agreement with the Mid Wales Railway to work the latter for one year commenced.
Meanwhile the Midland Railway which had gained access to Hereford by means of running powers over the Worcester & Hereford Railway, (which had become part of the Great Western Railway in 1863), now entered into an agreement to work the HH&BR in return for exclusive running powers. The GWR objected to this agreement and on 1 October 1869 denied the first Midland train access to its Barton station, and forbade its use by the Midland Railway until 1 April 1874. During this time Moorhampton station was used as the terminus for the Hereford to Brecon passenger service. The HH&BR was leased to the Midland Railway in 1874.