Penicuik's original station on the Peebles Railway was a mile or so from its centre and not easy to access thanks to the hilly terrain. An approach by the townsfolk for a separate branch into the town was rejected, resulting in the local paper mills' proprietors - and other gentlemen from the district - establishing the Penicuik Railway Company to make progress with one independently, enabled by a Parliamentary Act of June 1870.
Although only 4¼ miles in length, the branch - engineered by Thomas Bouch and built by John Waddell - presented considerable challenges, costing about £12,000 per mile and crossing the River North Esk seven times. Two short tunnels were driven through spurs of land whilst a third, of 248 yards, was effectively created by covering the line as it passed close to the Roslin Gunpowder Mills. This iron structure was later dismantled, the mills having closed in 1954.
The branch opened to goods on 9th May 1872, slightly later than contractually stipulated, resulting in the contractor suffering a penalty of £10 per day. Passenger services were inaugurated on 2nd September.
Firth, the longer of the two tunnels at 111 yards in length, drove the railway through Old Woodhouselee, just to the west of Firth Viaduct. The east portal is stone-built, featuring triangular wing walls, the north side being considerably longer. The tunnel itself is straight and horseshoe-shaped in profile with a five brick thick lining. Water ingress has caused localised spalling. Its refuges have been blocked up as part of the conversion work undertaken to host the popular Penicuik to Dalkeith Walkway. High on the north sidewall are insulated brackets, used to carry telegraph wires. The west portal, also in stone, has symmetrical wing walls.
Closed to regular passenger traffic in September 1951, the branch continued to carry freight until it succumbed to Beeching's reshaping on 27th March 1967, driven by the repairs necessitated by two landslips.