Jason Harries’ first-half try meant Edinburgh were all square with their hosts at the interval as John Cooney gave Ulster an early lead, but it seemed as if the game was going away from Edinburgh when Cooney kicked a couple of penalties to start the second half.
Lewis Carmichael gave the Scottish outfit hope with a second try 18 minutes from time and Sam Hidalgo-Clyne converted for the second time to put Richard Cockerill’s troops a point ahead, but Ulster hit straight back and Cooney’s third penalty of the night edge the lead in Ulster’s favour.
But at the death Weir slotted a drop goal to give Edinburgh a deserved victory ahead of next weekend’s clash away to the Dragons.
Edinburgh had confidence and momentum on the back of their brilliant 29-24 bonus point win over Leinster in Round 14.
Scotland internationals John Hardie and Cornell du Preez both returned to the Edinburgh back row and they were ready for a massive physical battle.
But they started slow and Ulster signalled their intent inside two minutes when Cooney’s up and under almost got Tommy Bowe away down the left wing.
Ulster continued to drive forward looking for the opening score, and although they lost their season’s top try-scorer Craig Gilroy to injury, the try did arrive.
It was a wonderfully worked move that began in midfield where Louis Ludik spotted a chance and combined well with Nick Timoney to exploit the weak Edinburgh defence.
Timoney returned the pass and then Cooney rushed up alongside his Ulster teammate to score under the posts in the ninth minute.
Cooney added the conversion and Ulster held a 7-0 lead early, in what looked to be the perfect start to another game under new head coach Jono Gibbes.
But the atmosphere soon became uneasy and Edinburgh started to find their rhythm in attack. Dougie Fife forced a crucial penalty off Johnny McPhillips in the 25th minute and that began the onslaught for the visitors.
Viliame Mata was the only Edinburgh back row retained from their win over Leinster, and he was central to everything towards the end of the first-half.
Mata had two potential efforts disallowed in the 26th and 30th minute, when he was adjudged to have stepped out into touch and knocked-on over the line respectively.
Ulster were forced to exert massive amounts of energy in defence and their rearguard would eventually give way, but it happened after they were deep in Edinburgh territory.
Sam Hidalgo-Clyne made the initial break, Mata ran a smart line to deflect the attention of the remaining Ulster defenders, and they were drawn from Harries, who raced through to dot down the perfectly weighted kick through.
Hidalgo-Clyne added the conversion and the game was tied. But Edinburgh weren’t happy with that and they went in search of the lead score before half-time.
The pressure was intense once again and Ulster were forced to defend their lines by an incessant Edinburgh attack.
But somehow Ulster held out, turned over possession, and got their clearance in for the half-time whistle – it was 7-7 at the interval.
Ulster could have been in disarray with their first choice scrum-half now in the No 10 slot, after McPhillips departed injured before half-time.
Cooney moved to out-half and youngster Johnny Stewart stepped in at scrum-half, and Ulster needed a score to settle them.
But crucially Cooney stepped up to kick a massive penalty from inside his own half to give Ulster a 10-7 lead in the 42nd minute.
Ulster suffered three big injuries against Southern Kings in the previous round, and a third player fell foul of this game when Dave Busby left for a HIA.
Edinburgh continued to mount the pressure but Ulster soaked it up and a silly error from centre Chris Dean gifted Cooney with his second penalty opportunity of the night.
The former Connacht scrum-half tapped over the resultant kick and suddenly Ulster were into a 13-7 lead against the run of play.
But Edinburgh were always going to get another chance and their second try came from an unlikely source. Carmichael popped up on the Ulster 22 and some sloppy defence allowed him to score.
Hidalgo-Clyne’s conversion pushed Edinburgh ahead but their lead was short lived and Cooney cancelled it out with an easy penalty. But Weir had the final say in the 82nd minute.
Ulster: L Ludik; C Gilroy, L Marshall, S McCloskey, T Bowe; J McPhillips, J Cooney; A Warwick, R Herring, W Herbst; A O’Connor, K Treadwell; M Rea, N Timoney, J Deysel.
Replacements: D Busby (for Gilroy 7), J Stewart (for McPhillips 36), D Cave (for Busby 45 HIA), J Andrew (for Herring 52), K McCall (for Warwick 52), R Ah You (for Herbst 52), C Henry (for Deysel 55), M Dalton (for Treadwell 67), A Warwick (for McCall 75).
Scorers – Try: Cooney; Cons: Cooney (1); Pens: Cooney (3)
Edinburgh: D Fife; J Harries, M Bennett, C Dean, D van der Merwe; J van der Walt, S Hidalgo-Clyne; J Lay, N Cochrane, M McCallum; F McKenzie, L Carmichael; B Mata, J Hardie, C du Preez.
Replacements: L Crosbie (for Hardie 54), R Sutherland (for Lay 54), E Millar Mills (for McCallum 54), M Bradbury (for du Preez 59), N Fowles (for Hidalgo-Clyne 65), C Fenton (for Cochrane 65), D Weir (for van der Walt 72).
Scorers – Try: Harries, Carmichael; Cons: Hidalgo-Clyne (2); Drop: Weir.
Referee: Nigel Owens (WRU)