Edinburgh clinched a Pro14 home semi-final in style after a comeback win against Glasgow at Murrayfield.
Tries from Pete Horne and Adam Hastings gave Glasgow a two-point half-time lead, with Edinburgh's 13 points coming from Nic Groome's score and the boot of Jaco Van der Walt.
But Edinburgh roared back, as Groom crossed for another and Van der Walt added the extras and a third penalty.
And replacement scrum-half Charlie Shiel's solo effort sealed a fine win.
The victory ensures Edinburgh will compete in the last four of the competition regardless of next week's return meeting with the Warriors, and, due to ensuring they end the conference with more wins than Munster, are guaranteed to face Ulster at home, rather than Leinster away in the semi-finals.
Glasgow's already slim play-off hopes are now finished, with head coach Danny Wilson enduring a tough start on his first game in charge.
Glasgow have no answer to Edinburgh surge
Edinburgh's pursuit of the win that has clinched a home semi-final in a fortnight's time began brightly with Van der Walt banging over two early penalties as Glasgow went through the horrors on the floor.
Time and again Hamish Watson jackalled them into frustration and time again their penalty count mounted. With the newly clarified laws of the breakdown driving them to distraction, Glasgow conceded six penalties in the opening 12 minutes. Overall, they shipped close to 20.
Things settled after a while. Hastings made it 6-3 then Horne darted over after Fraser Brown's hack forward and Blair Kinghorn's problems in mopping up brought Glasgow to the Edinburgh 22. The edge between these players was on show in the immediate aftermath when Stuart McInally hoiked Hastings round the neck as the fly-half went to celebrate the score. He exacted revenge when adding the conversion to make it 10-6 Glasgow.
The lead was short lived. Glasgow held out well under heavy pressure but the strain was too much in the end. When Groom found a sliver of space at the side of a ruck on the line, the scrum-half took advantage. Van der Walt's boot made it 13-10.
It switched again just after the half hour when patience and accuracy and carries from Oli Kebble and Zander Fagerson had Edinburgh in trouble. Hastings was on hand to capitalise on the grunt of his front-row heavies.
A two-point lead at the break was two points too many for Richard Cockerill's liking. He took off Rory Sutherland and WP Nel in search of better carriers and more aggression.
The man they wanted on the ball more than any other was Van der Merwe and he duly obliged on the hour with one of his trademark breaks. When the soon-to-be Scotland Test wing gets up a head of steam then it takes a hell of an effort to stop him in his tracks.
When he barrelled clear Glasgow would have known instantly they were in trouble. He stepped outside Hastings, fended-off George Horne and then cushioned a one-handed offload to Groom, who ran in his second score of the night.
Van der Walt's conversion and a penalty soon after put Edinburgh eight points clear. Glasgow never looked capable of mounting a comeback. When Edinburgh upped the intensity after an hour, they never had an answer to it.
There was a third Edinburgh try before the end when Shiel ran away from three jaded Glasgow defenders to score a beauty. Three scrum-half tries. A decent night for the Edinburgh 9s. The conversion made it double scores. A sore one for new Glasgow coach, Danny Wilson. A real boost for his counterpart Cockerill as the semi-final looms.
Glasgow Warriors: (15) H Jones (14) T Seymour (13) N Grigg (12) P Horne (11) R Tagive (10) A Hastings (9) A Price; (1) O Kebble (2) F Brown (captain) (3) Z Fagerson (4) R Gray (5) S Cummings (6) Rob Harley (7) M Fagerson (8) R Wilson
Replacements: (16) G Turner (17) D Evans (18) D Rae (19) K McDonald (20) T Gordon (21) G Horne (22) N Matawalu (23) Glenn Bryce
Edinburgh: (15) B Kinghorn (14) E Sau (13) M Bennett (12) C Dean (11) D van der Merwe (10) J van der Walt (9) N Groom; (1) R Sutherland (2) S McInally (captain) (3) W Nel (4) A Davidson (5) G Gilchrist (6) L Crosbie (7) H Watson (8) V Mata
Replacements: M Willemse (16) P Schoeman (17) S Berghan (18) J Hodgson (19) N Haining (20) C Shiel (21) N Chamberlain (22) G Taylor