OUT-HALF Nathan Chamberlain was the hero for Edinburgh as he snatched victory deep into stoppage time at the Sportsground.
Connacht paid the full price for failing to close out the game on a bad night for Andy Friend's men whose captain Jarrad Butler was sent off and is now doubtful for their Challenge Cup showdown with Leicester Tigers next month.
He was red-carded for a shoulder to Andrew Davidson's head on 57 minutes.
Richard Cockerill's men reduced the deficit to 14-8 with ten minutes remaining. Connacht looked to have done enough but 20- year-old Chamberlain cut through their defence to score with the clock on 83 minutes and tapped over the conversion to keep their Champions Cup qualification hopes alive.
Connacht knew they couldn't improve on their second place in the conference and after Edinburgh opted to play against the wind in the first half, they dominated the opening quarter but struggled to convert possession.
All they had to show for 63 per cent possession in that time was a try from centre Sean O'Brien, who was making his first start, when the 22-year old from Mullingar finished following a recycle from their top try scorer Alex Wootton.
Edinburgh, missing ten internationals who will be on duty at Murrayfield today, eventually lifted the siege and started to come into the game.
Despite losing loosehead prop Pierre Schoeman to a knee injury, they got right back in contention eight minutes from the break when a superb break from Chamberlain stretched the defence and while it took several phases to go from inside the 22 to over the line, they were rewarded for their patience when Magnus Bradbury stretchered to score.
Chamberlain was unable to add the tricky conversion into the elements and they suffered a further blow when Connacht hit back and struck for a second try just before the interval.
A second penalty to the left corner was taken by Cian Prendergast on his first start and hooker Shane Delahunt supplied the finish after a good drive. Carty converted from the left touchline to lead 14-5 at the break.
Edinburgh, backed by the elements, enjoyed good possession after the restart but their ill-discipline cost them dearly.
Connacht, with Carty leading the way at out-half, managed the game well against the elements and Edinburgh struggled to make the extra man count until those hectic closing minutes.
Connacht 14
Tries: O'Brien 5, Delahunt 40
Conversions: Carty 5, 40
CONNACHT: Wootton 7; O'-Donnell 6 (McNulty 66, 6), O'Brien 7, Daly 7, Healy 6; Carty 7, Marmion 6 (Blade 62, 6); Buckley 7 (Duggan 54, 6), Delahunt 7 (Murphy 59, 6), Aungier 6 (Kenny 54, 6); Murray 7, Thornbury 8; Prendergast 7 (Papali'i 49, 6), Butler 7, Masterson 6
Not used: Oliver, Fitzgerald
Edinburgh 15
Tries: Bradbury 32, Chamberlain 80+3
Conversions: Chamberlain 80+3
Penalties: Chamberlain 70
EDINBURGH: Hoyland 7; Blain 6 (Savala 68, 6), Johnstone 6 (Bennett 62-68, 6), Taylor 6, Sau 6; Chamberlain 7, Shiel 7 (Pyrgos 49, 6); Schoeman 7 (Venter 24, 6), Willemse 6, Atalifo 6 (Williams 68, 6); Bradbury 7 (Davidson 69), Davidson 6 (Hodgson 57, 6); Crosbie 7 (Kunavula 59, 6), Miller 6, Mata 7
Not used: Kitchen
REFEREE: Chris Busby
Star man: Gavin Thornbury – Connacht