Johnny May scored a try four minutes from time to hand Gloucester victory and deny Connacht what looked to have been their first victory in the Heineken Cup.
The Irish Province held the lead from mid-way inside the first period and looked in control as the game drew to a close, but May on as a replacement scored a stunning solo effort to the delight of the Kingsholm faithful.
Gloucester fly-half Tim Taylor opened the scoring with a seventh minute penalty but the hosts didn't hold the lead for long.
The Cherry and Whites tried to play from deep and were caught out as Connacht intercepted and raced clear. Gloucester scrambled back in defence, but the support play from Connacht was on hand and Tiernan O'Halloran divded over and Niall O'Connor added the extras.
Taylor then scored an impressive individual try, twisting and turning his way to the line to snatch the lead back for Gloucester.
But six more points from the boot of O'Connor before the break gave Connacht a 13-10 lead.
Whilst Gloucester came out looking to step up a gear in the second period, Connacht continued from where they left off in the first-half, causing the hosts plenty of problems.
And it was Connacht, through O'Connor who got the first score, the fly-half kicking another penalty for the Irish province.
It took Gloucester until 58th minute until they got their next points as replacement Freddie Burns kicked them back to within three with his first penalty.
The hosts began to throw everything at their visitors and finally got back on level terms with 12minutes to go as Burns kicked his second penalty.
O'Connor kicked a further penalty and looked to have won the game for Connacht until May struck, handing off the defence and then sprinting into the corner.