Saints had an opportunity to take an early lead but Lamb missed a penalty before being involved again when his kick was charged down by Ruan Pienaar, although the covering Ben Foden denied Ulster.
However, the visitors were soon ahead when Gilroy's replacement, Trimble, scored his 20th try in the Heineken Cup as he raced ahead of Foden to touch down following Paddy Jackson's kick over the top.
Jackson missed the conversion attempt before Lamb and Jackson again missed further penalties in the blustery conditions.
Lamb, at the third attempt, finally got Northampton's first points to reduce the deficit to two but Ulster restored their five-point lead two minutes later thanks to Jackson's penalty.
Ulster, top of the Pro 12 with 10 league wins out of 10, scored their second try six minutes before the break after Payne's precise kick into touch led to a sustained spell of pressure.
Pienaar and Iain Henderson were both blocked short of the line, but a quick passing move to the other side of the pitch, involving Darren Cave and Paddy Wallace, led to the overlapping Bowe diving over in the corner.
Lamb's late penalty left Saints 13-6 behind at half-time but his side would have held the lead if he had been successful with his other three attempts.
Ulster stretched their advantage within five minutes of the restart when full-back Payne collected a pass from Trimble, fooled Foden with a dummy and sprinted through a gap in the home defence.
Saints pushed to get back in the match but Pienaar held up Jamie Elliott before replacement Tom May fumbled the ball five yards from the line.
Ulster, who ended the match with 14-men after Henderson was sin-binned with nine minutes left for not releasing a player on the ground, snatched the bonus point in the last minute when Payne released Tuohy, who dived over.
The two sides play again on Saturday, 15 December at Ravenhill in a match Northampton must win to keep alive their Heineken Cup hopes.
VIEWS FROM THE DRESSING ROOM
Northampton Saints director of rugby Jim Mallinder told BBC Radio Northampton:
"I'm hugely disappointed. It was a big night for us. They were physical, defensively very good and we were struggling to put together any serious attacking threats.
"We got caught on a couple of occasions and they took their opportunities - four of them, and they scored from all of them.
"Phil Dowson and Lee Dickson brought a bit of tempo to the game but overall it was a bad night. They were the better team and they deserved to win.
"Ulster are clear favourites to go through."
Ulster coach Mark Anscombe said:
"That was a bit of a statement. We weren't even thinking about the bonus point - we were more than happy to come here and take the win.
"We're not getting carried away as Northampton have too many quality players and they will bounce back from this performance.
"We have to go out and do it again next week or this will count for nothing."
B Foden; K Pisi, G Pisi, D Waldouck, J Elliott; R Lamb, M Roberts; S Tonga'uiha, D Hartley (capt), B Mujati; S Manoa, C Lawes; C Clark, T Wood, GJ Van Velze.
M Haywood (for Hartley 71), A Waller (for Tonga'uiha 63), P Doran-Jones (for Mujati 60), P Dowson (for Clark 57), L Dickson (for Roberts 51), S Myler (for Lamb 60), T May (for Waldouck 66).
J Payne; T Bowe, D Cave, P Wallace, A Trimble; P Jackson, R Pienaar; T Court, R Best, J Afoa, J Muller (capt), D Tuohy, I Henderson, C Henry, R Wilson.
C Black (for Court 69), R Diack (for Wilson 79), N Williams (for Muller 50),L Marshall (for Wallace 69), C Gilroy (for Trimble 69).
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.