Tim Taylor held his nerve and converted Tom Voyce's last minute try as Gloucester capped a remarkable comeback with the win which takes them into the semi finals of the LV=Cup.
Gloucester had come into the game knowing that a bonus point win would be enough to qualify for the semi finals.
The table topping Scarlets had 11 points and nine tries from their four games so a bonus point win would taken Gloucester to the top of the group with 11 points and a minimum of ten tries.
It was a big ask and it took every single one of the 80 minutes.
And it all looked very unlikely as the opening quarter saw Gloucester staring down the barrel of a big defeat.
Had the game started after 25 minutes, Gloucester would probably have romped away with this one.
However, they were 20-0 down by that point and the deficit proved to be just almost too much until the late heroics.
The semi final berth is reward for those efforts and a valuable psychological ahead of the Guinness Premiership meeting betwen these sides next weekend.
A much changed line up saw first starts for Tim Taylor, Semi Tadulala and Rupert Harden whilst Lesley Vainikolo got an rare run out in the inside centre position.
Gloucester had the first chance of points as Quins dropped the opening kick off and picked up the loose ball from an offside position but Tim Taylor pushed his kick across the posts.
The home side though were first on the board as swift hands put Josh Drauninui into space on the left. The winger made good ground before being tracked down but Gloucester were offside in midfield as the ball came back and Nick Evans kicked an easy penalty for 3-0 after five minutes.
Gloucester had a couple of decent backs moves which came to naught in the opening stages but Evans was looking dangerous and his break and subsequent chip had Gloucester under pressure after 8 minutes.
Quins fancied the catch and drive. The first was illegally brought down but the second brought reward with a try for James Percival after Matt Cairns was brought down just short. Evans converted with ease.
Bad duly went to worse as Gloucester gave away a ruck penalty giving Quins excellent field position. The forwards drove on before Evans dummied his way over for the second try. His conversion hit the upright and stayed out but 15-0 after 13 minutes was a rough start.
It got rougher. Gloucester lost their first lineout and then saw Dawidiuk yellow carded for coming in the side of a maul although the 7 man pack dug deep to keep Quins at bay.
However, the errors continued to cost Gloucester dear. Taylor's kick to the corner after a rare foray into Quins' territory went dead giving Quins scrum ball.
Guest picked up and slipped Narraway's tackle before making good ground and linking with Dickson. The scrum half took a good angle and Evans came on a great line to take the pass and hold off Tadulala to score. 20-0 after 24 minutes.
Gloucester finally clicked on the half hour. Clean lineout ball saw Vainikolo suck in tacklers in midfield and Voyce's pass gave Simpson-Daniel an opening which the winger exploited with speed and strength. Taylor's excellent touchline conversion narrowed the gap to 20-7.
It prompted Gloucester's best spell of the game as forwards and backs combined to keep hold of the ball through multiple phases before Taylor dummied his way through to score under the posts. The debutant fly half converted his own try to bring the game back to 20-14.
Incredibly, Taylor then dummied his way through again with only second left on the clock but his inside pass was intercepted as a sensational third try looked on the cards.
As the teams went into half time, Gloucester still trailed 20-14 but such a scoreline would have been unthinkable only minutes before as wave after wave of Quins attack swept forward.
However, the fightback had been impressive and Gloucester were still well and truly in the game which had looked very unlikely after the first quarter.
More of the same was required but Quins got the better start to the second period as Evans punished Gloucester for an indiscretion at a ruck with a well struck long range penalty for 23-14.
Gloucester weren't done though. Simpson-Daniel was a constant threat and his half break led to the sinbinning of replacement Quins' lock Tomas Vallejos for killing the ball.
Enjoying an extra man up front, Gloucester had a couple of chances to force home a score and looked odds on to score at the third attempt but the ball was held up over the line and Quins weathered the storm.
The home side cleared downfield and earned a cheap penalty for holding on in the tackle on the Gloucester but the previously impeccable Evans pushed his kick wide right.
However, the Kiwi made amends just two minutes later when another ruck penalty afforded him a second chance and he made no mistake.
Still Redpath's men weren't done as Voyce came steaming on to Taylor's long pass and burst through. he was tackled by Brown as he made for the line but offloaded to Simpson-Daniel whose second score made it 26-19.
Gloucester needed discipline and just a bit of luck to get back on terms but yet another ruck penalty followed by back chat gave Evans a simple penalty for 29-19.
Apo Satala's powerful run almost brought a fourth try for Gloucester but the Quins defence just got back and feverish tackling kept their line intact but Tim Molenaar smashed his way over moments later after a great break from Andrew Hazell.
The final minutes saw Barbarians like rugby from Gloucester as they pressed for the win with the the previosuly buoyant Quins supporters becoming increasingly nervous.
A catch and drive and held up before the backs were brought into play and Voyce somehow wriggled his way over for the fifth try.
It was all down to Taylor and the former Nottingham man showed nerves of steel to bisect the posts and earn Gloucester the win.