Northampton's Tom May is tackled by Scarlets' Scott Williams
Northampton kept alive their hopes of at least progressing to the Challenge Cup knock-out stages after holding off a profligate Scarlets.
Fly-half Rhys Priestland kicked four penalties and set up wing Viliame Iongi for a try to put the hosts in control.
But Soane Tonga'uiha stretched over for a Saints try after the restart and Stephen Myler kicked the visitors into a five-point lead.
Scarlets pressed but an intercepted pass saw Ben Foden race in late on.
Victory lifted Northampton above the Scarlets into second in their Heineken Cup pool, leaving Saints with a chance of a runners-up spot that is unlikely to be enough for Heineken qualification but could clinch a place in the second-tier Challenge Cup quarter-finals.
Much of the pre-match focus had been on referee Alain Rolland, who was taking charge of a game in Wales for the first time since sending off Sam Warburton in the national side's World Cup semi-final defeat to France.
And the Irishman was soon in the spotlight again when he sin-binned Saints centre Tom May for throwing the ball at Gareth Davies.
That ill-discipline, and a ruck offence from Dylan Hartley, allowed Priestland to open a 6-0 lead with two penalties, before Myler responded with a three-pointer of his own.
Priestland's third penalty then arrived after Rolland reversed a call against the Scarlets.
Northampton started to get a foothold in the game but a superbly-judged cross-kick by Priestland allowed Iongi to dot down on 32 minutes and give the hosts a 14-6 lead at the break.
Saints battled their way back into the game within nine minutes of the restart, as Tonga'uiha grounded the ball after a maul had rumbled over the Scarlets' tryline.
Myler added the conversion before slotting his third penalty after a scrappy passage of play to give Northampton the lead for the first time.
Priestland responded with a penalty of his own, but two further three-pointers from Myler put the visitors 22-17 ahead.
The home side introduced Stephen Jones in an effort to get back into the contest and late pressure almost saw full-back Liam Williams and scrum-half Davies score.
Chances continued to come and go for the hosts until a misplaced pass by replacement Rhodri Williams allowed Foden to run the length of the field and clinch victory.
Northampton Saints director of rugby Jim Mallinder told BBC Radio Northampton:
"Although we probably still won't qualify [for the Heineken quarter-finals], it's fantastic to come here and win. We were disappointed with our home defeat, and we wanted to show we were a quality side.
"At half-time, we wanted to put the ball in behind them and put them under pressure. We managed to do that.
"The players put their bodies on the line, and some last-ditch tackling saved us. We're delighted. We owed Scarlets one, and we feel we owe Munster one."
Scarlets coach Nigel Davies told BBC Radio Wales:
"We played with good intent and spirit, the intensity was good and you couldn't ask much more from the players in terms of commitment, but we were a little bit inaccurate and didn't take the opportunities which were presented to us.
"There were more than a couple of chances near the end. I thought the boys were fantastic in their work-rate but just have to be a little bit more clinical in this level of tournament.
"We didn't start the second half particularly well, we couldn't get out of our own territory and that's where they got their points. We were chasing the game after that. We had to be very accurate and we weren't."
L. Williams, North, S. Williams, J. Davies, Iongi, Priestland, G. Davies; I. Thomas, M. Rees, Manu, Reed, Day, Shingler, McCusker, Morgan.
S. Jones for Iongi (58), R. Jones for G. Davies (73), John for I. Thomas (58), Owens for M. Rees (57), R. Williams for Manu (73), J. Edwards for Day (65), Turnbull for McCusker (75). Not Used: Maule.
Armstrong for May (74), Lamb for Myler (73), Doran-Jones for Roberts (58), A. Waller for Tonga'uiha (70), Haywood for Hartley (70), Dickson for Mujati (58), Day for Sorenson (63), Nutley for Haywood (73).
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.