Glasgow Warriors grabbed a narrow derby win over Edinburgh to move second in the Pro12 table, boosting their chances of a home play-off tie.
The bonus point win at Scotstoun also secured the 1872 Cup for the Warriors, as the aggregate score of the two meetings of the sides this season was 57-50 in Glasgow's favour.
Warriors were 23-13 up at the break after a frantic first half.
But Edinburgh stuck with them and left with two bonus points of their own.
The first half started in frantic fashion and a poor kick from Greig Laidlaw gave Glasgow possession, with the visitors eventually conceding a penalty that Finn Russell banged over.
Ruaridh Jackson's kicking put Edinburgh under continual early pressure and Glasgow cashed in by scoring their first try after seven minutes.
The hosts worked it well from a line-out and Chris Cusiter was pivotal as the ball was fed to Peter Murchie, who ran over in the corner. Russell was unable to add the extras from the right.
Glasgow continued to press and were awarded another penalty after poor play by Edinburgh, with Russell making it 11-0.
The visitors got themselves back into the game in the 15th minute. Jack Cuthbert burst through the centre before Laidlaw produced a chip that took his side towards goal, with WP Nel barging his way over and Laidlaw converting.
Russell then missed a penalty before Andries Strauss looked to have given Edinburgh the lead with a try in the corner. It went to the Television Match Official, however, who ruled Strauss's foot had hit the line before he touched down.
The referee brought the play back for a penalty, though, and Laidlaw scored.
Play soon raced to the other end and Glasgow kept the scoreboard buzzing with another try.
Mark Bennett's brilliant run was halted illegally by Izak van der Westhuizen, but Jackson still managed to get over the line for 16-10, though Russell could not convert. Westhuizen went to the sin bin for his high tackle.
Edinburgh won another penalty after the excellent Matt Scott again broke the defensive line, with Laidlaw reducing the deficit to three points after 35 minutes.
A penalty allowed Jackson to kick Glasgow deep into the Edinburgh half and from the lineout the hosts eventually won another penalty inside the 22.
Jackson again kicked into touch with Glasgow winning the lineout and feeding it out to Mark Bennett, who ran over on the left with Russell adding the extras.
Glasgow raced out the traps again in the second half, and Edinburgh's Mike Coman was sent to the sin bin within 90 seconds. Jackson kicked for touch and from the lineout, five metres out, Jonny Gray was driven over but the TMO ruled it out for double obstruction.
The Warriors produced superb periods of passing play as they attacked at every opportunity and their first try of the second half came in the 48th minute.
The hosts kept the ball brilliantly and after Russell was taken down within striking distance of the line, Cusiter fed it wide and Murchie grabbed his second try of the night, securing the crucial bonus point. Russell converted to take the score to 30-13.
Scott kept Edinburgh in it with a 58th minute try following great work by Sam Beard, and Laidlaw made no mistake with the conversion.
The visitors enjoyed a period of dominance but Glasgow weathered the storm and, following a quick tap by Niko Matawalu from a penalty, Robert Harley ran over with less than five minutes to play. Russell converted to take the score to 37-20.
Edinburgh gave their rivals a scare in the final minutes with two converted tries by Tomas Leonardi and Tim Visser to earn a second bonus point.
Glasgow Warriors: Murchie, S. Maitland, Bennett, Russell, Seymour, Jackson, Cusiter, Grant, Hall, Welsh, Gray, Kellock, Harley, Fusaro, Strauss.
Replacements: Weir for Jackson (77), Yanuyanutawa for Grant (77), MacArthur for Hall (51).
Edinburgh: Cuthbert, Brown, Scott, Strauss, T. Visser, Bezuidenhout, Laidlaw, Dickinson, Ford, Nel, Gilchrist, van der Westhuizen, Coman, Du Preez, Denton.
Replacements: Beard for Strauss (51), Hart for Laidlaw (61), Blaauw for Dickinson (77), Hilterbrand for Ford (77), Berghan for Nel (61), Leonardi for van der Westhuizen (51), B. Toolis for Coman (77).