Connacht earned their first Pro12 win since September as they put one over on their former coach Michael Bradley.
Fetu'u Vainikolo's try helped Connacht lead 10-0 at half-time but tries from Tim Visser and Chris Paterson cut the home team's lead to three points by the hour mark.
However, replacement Matthew Jarvis's penalty extended Connacht's lead before a late try by Mike McCarthy sealed it.
Niall O'Connor kicked a crucial 11 Connacht points before being replaced.
After Gregor Hunter missed a penalty chance to put the visitors ahead, O'Connor, whose late kick earned Connacht a draw against Glasgow last week, struck his side into the lead on 20 minutes.
With loosehead Denis Buckley impressing on his first start, the Connacht scrum helped set up the counter-attack that led to their first try.
Frank Murphy continued the move and an inside pass from O'Connor helped set up Vainikolo for a scrambled 33rd-minute try.
Trailing 10-0 at the break, the visitors came out fired up for the re-start and only a knock-on prevented a try following Kyle Traynor's 20-metre burst.
O'Connor's second penalty increased Connacht's lead but despite Tom Brown's sin-binning, Edinburgh hit back with Visser's 11th try of the campaign after Gavin Duffy's clearance had been charged down.
O'Connor squeezed in another penalty before Edinburgh broke down the narrow side off a scrum and the excellent Jim Thompson passed for Paterson to dart away and over for an unconverted try.
Godman landed a penalty on the hour mark and Connacht had to defend manfully as Edinburgh continued to probe for tries.
However, O'Connor's replacement Jarvis gave the home side some breathing space with a 68th-minute penalty and some great interplay between the excellent Muldoon and McCarthy produced the clinching try.
Connacht: G Duffy (capt); F Vainikolo, K Tonetti, H Fa'afili, T O'Halloran; N O'Connor, F Murphy; D Buckley, A Flavin, R Loughney; M Swift, M McCarthy; J Muldoon, E Grace, G Naoupu
Replacements: M Jarvis for N O'Connor 55, B Wilkinson for Buckley 54, E Reynecke for Flavin 60, S Maguire for Loughney 76, R Ofisa for Grace 47.
Not Used: Kearney, O'Donohoe, Griffin.
Edinburgh: C Paterson; T Brown, J Thompson, M Scott, T Visser; G Hunter, C Leck; K Traynor, A Kelly, J Gilding; G Gilchrist, S Cox; S McInally, R Grant (capt), N Talei.
Replacements: D Fife for Paterson 71, P Godman for Hunter 40, U Gamboa for Gilding 56, E Lozada for Cox 74.
Not Used: Walker, MacDonald, Watson, Black.