Forfar made it through to face St Johnstone by winning an exciting all-Angus Scottish Cup fourth round replay at Station Park.
The Loons grabbed their place in the last 16 with a 4-3 penalty shootout victory over their county rivals despite being behind three times.
They now have an appetising tie to look forward to against Saints on either February 8 or 9.
In the shootout, home keeper Rab Douglas saved Jonathan Brown’s first kick then Gavin Malin made it 1-0 to the hosts. Stephen Jackson netted for City, Paul McManus made it 2-1 then Bobb Barr pulled Brechin back level again.
Gary Fusco netted for Forfar, Graham Hay made it 3-3 then Iain Campbell missed for the Loons.
That opened the door to Brechin but Alan Trouten’s kick was saved by Douglas, leaving home substitute Craig Smith to be the hero.
Andy Jackson had grabbed an opener for Brechin before Chris Templeman levelled for the hosts with a header on 19 minutes.
Omar Kader should have made it 2-1 to the home team seconds before the break but his remarkable miss meant the match was finely poised heading into the second half.
A penalty by Trouten edged the visitors ahead on 50 minutes but a strike from Malin ensured an extra half-hour.
Substitute Allan Walker edged Ray McKinnon’s side in front again five minutes into the additional time only for Templeman to haul the hosts level for a third time.
Despite the pre-match worries expressed by boss Dick Campbell, the Loons had all of their injury doubts apart from Dale Hilson fit and ready to go.
After a scrappy start, Brechin took the lead with a beautifully-worked goal on seven minutes.
Steven Robb was the creator with a great run through the middle of the park then a defence-splitting pass that sent Jackson clear.
The former St Johnstone man finished clinically by squeezing a low shot between keeper Douglas and his near post from eight yards.
On 14 minutes, Forfar were almost level when striker Templeman took the ball around diving goalie Graeme Smith. His angled shot was goalbound but Stephen Jackson booted the ball off the line.
Just five minutes later, though, the Loons were level.
A corner out on the left was superbly delivered by Martyn Fotheringham and, as the ball hung in the air, Templeman climbed to send his header back across goal and inside the left-hand post.
A 25-yard strike from Brechin’s Darren Petrie tried to regain the initiative for the visitors but Douglas did well to push the shot to safety.
Then came the amazing miss from Kader on the stroke of half-time. A nice chip-cross from Gavin Swankie from the right landed on his head a couple of yards from goal but he nodded wide when it was easier to score.
Just five minutes after the turnaround, Forfar paid the penalty.
Petrie picked up possession just inside the box, tried to move past defender Neil McCabe but fell to the floor.
Referee John McKendrick decided it was a trip and pointed to the spot. Up stepped Trouten to find the bottom left-hand corner to put City ahead again.
There was more trouble for the Loons minutes later when Swankie hobbled off to be replaced by Craig Smith, while Malin came on for McCabe.
Smith nearly made an instant impact, though, when he cracked a ferocious strike off the Brechin bar from 25 yards after being set up by fellow sub Malin. The ball bounced down but, sadly for Forfar, it landed the wrong side of the line.
City brought on Walker for Robb on 69 minutes, while the Loons swapped McManus for Fotheringham as both sides looked to freshen things up.
On 80 minutes another Templeman header looked netbound but, much to the big man’s dismay, the ball was cleared away.
Just four minutes later, it was 2-2.
A neat build-up from Forfar created space for Malin inside the box and he took a touch before burying his low shot into the far corner to send the tie into extra-time.
Graham Hay shot over from close range for Brechin a minute into the first extra period, then they looked to have scored when Douglas fumbled under pressure from Jackson. The ball trundled over the goalline but ref McKendrick awarded a freekick to Forfar.
In the 95th minute, however, it was 3-2 to City. It was a cracker ofrom sub Walker, who gave Douglas no chance with a great right-foot strike from just outside the box.
This topsy-turvy match saw Forfar level again three minutes into the second period. Templeman rose to head off the bar and it bounced down.The goal was given, much to the anger of the Brechin players.
City had another great chance when sub Ryan Donnelly, just on the park, headed from close range but keeper Douglas pulled off a fantastic save.
A Darren Dods header was cleared off the line at the other end with just three minutes left before the whistle signalled penalties, with Forfar edging it 4-3.