Gloucester survived a frantic finish to end Connacht's unbeaten run in the European Challenge Cup with a 33-28 quarter-final win at the Sportsground.
Replacement Billy Twelvetrees' 77th-minute penalty proved to be the final score of an eight-try thriller, as last year's runners-up set up a home semi-final against Aviva Premiership rivals Newcastle Falcons next month.
Tries from James Hanson, Tom Marshall and man-of-the-match Henry Trinder had the Cherry and Whites 17-10 up at half-time, with returning Grand Slam winners Kieran Marmion and Bundee Aki touching down for Connacht.
The hosts twice got back within two points thanks to second-half tries from Niyi Adeolokun and Matt Healy, but John Afoa's 55th-minute score on his 100th club appearance - coupled with the place-kicking of Owen Williams (10 points) and Twelvetrees - had Gloucester out of reach.
Connacht fell behind in the third minute when Quinn Roux stole Hanson's lineout throw but the tap-down bounced nicely for the Gloucester hooker, who gathered and cut inside Healy for a 5-0 lead.
In response, the Irish province forced a scrum penalty and threatened from a maul. Jack Carty's inviting offload then sent his half-back partner Marmion nipping over to the right of the posts, with Carty unable to convert in a tricky wind.
Gloucester's fifth penalty concession in 15 minutes saw number eight Ben Morgan sin-binned for a high tackle, and a terrific team move soon led to Connacht's second try.
Hooker Tom McCartney was involved twice, firstly via Denis Buckley's tip-on pass and then popping up to collect Carty's offload and send Aki powering over to make it 10-5.
The wind foiled Carty's conversion attempt and it was a similar case for fly-half Williams' kick after Gloucester had released winger Marshall for the left corner. Welshman Williams' long pass supplied a superb assist.
The Cherry and Whites got on top in a crucial period before the break. Ed Slater had a try ruled out for a forward pass, but centre Trinder's quick feet took him around Roux and over for the lead try.
Williams finally bisected the posts with a cracking conversion, and it was the Wales international's 41-metre penalty which opened the second half's scoring.
However, Connacht winger Adeolokun then burst into life, beating Marshall and Williams to Marmion's grubber kick over the try-line. A subsequent Carty penalty had the gap down to 20-18 but Gloucester had an answer.
They blew a couple of opportunities before Williams' pull-back pass had Mark Atkinson dashing into space and he gave the supporting Afoa a clear run to the line. Williams converted and tapped the nail into Connacht's coffin further with a 63rd-minute penalty.
The westerners' never-say-die attitude brought them back into contention, replacement Craig Ronaldson landing a penalty after Gloucester flanker Lewis Ludlow was binned for a shoulder charge on Marmion. Aki then threaded a kick through for Healy to collect and step inside Jason Woodward for a 70th-minute converted try.
With their lead cut to 30-28, 14-man Gloucester showed impressive composure and duly dominated possession, Twelvetrees knocking over a vital three-pointer after Connacht openside Jarrad Butler saw yellow for a deliberate knock-on.