Substitute Ben Botica kicked a 78th-minute penalty to keep alive Harlequins' European campaign and give them a consolation prize of an Amlin Challenge Cup quarter-final place.

Quins, already out of Heineken Cup last-eight contention, moved into the Amlin knockout phase along with Northampton and Gloucester by prevailing in west Wales.

They secured the final Amlin spot for three Heineken runners-up when Botica rifled over the winning kick just two minutes from time.

Left it late: Ben Botica kicks a penalty with minutes remaining as Harlequins come out on top against Scarlets

Wales centre Scott Williams looked to have claimed the Pool Four encounter's decisive touchdown, which followed earlier Scarlets tries by scrum-half Gareth Davies and flanker Aaron Shingler, while Rhys Priestland kicked a penalty and conversion.

Quins scored three tries of their own - full-back Mike Brown, wing Ollie Lindsay-Hague and scrum-half Karl Dickson the scorers - and Nick Evans booted two conversions during a game when the visitors led 14-7 and 19-15 before they finally sealed victory.

The Scarlets looked to be safe as the clock ticked down, but Quins kept going and their reward is an Amlin last-eight clash away to Stade Francais in early April.

But the Scarlets are left to concentrate solely on domestic business following three defeats from six Heineken starts this term.

And it means that none of the Welsh regions - Scarlets, Ospreys, Cardiff Blues and Newport Gwent Dragons - have secured a place in either the Heineken or Amlin quarter-finals for a second successive season.

The Scarlets announced their intentions by stunning Quins with a superb fifth-minute try that had is origins deep inside their own half.

Wing Jordan Williams prospered from a Priestland long pass by standing up the Quins defence, and after number eight Rob McCusker acted as link-man, Davies sprinted 30 metres to score.

Priestland converted, and the Scarlets were off and running in pursuit of an Amlin place before Shingler gave Quins a temporary one-man advantage when he received a yellow card for a dangerous charge on Tom Guest.

It was poor discipline by the Wales Six Nations squad member, and Quins punished the Scarlets by responding through a Brown touchdown created by Evans' approach work, and the New Zealander's conversion made it 7-7.

A torrential downpour made conditions treacherous midway through the first-half, but Quins - and Brown in particular - were determined not to be knocked out of their stride, with a second Quins try arriving after 28 minutes.

Technique: Gareth Davies offloads the ball after a scrum

Slick handling stretched the Scarlets defence, and it was Brown's deft inside pass that enabled Lindsay-Hague to cross unopposed before Evans' conversion established a seven-point advantage.

Back came the Scarlets, though, and after a Priestland penalty narrowed the deficit, Shingler scored an opportunist try that left Quins one point behind at half-time.

Quins appeared to be in little danger at a set-scrum near their own line, but when the ball squirted free from the base, Shingler reacted quickest and put his hand on it for a try that referee Jerome Garces awarded following consultation with television match official Jean-Marie Piraveau.

The second-half started at breakneck pace, as Quins briefly regained the lead before it was snatched back from them with the lead changing hands for a fourth time.

Desperate: Nick Evans just about gets back to tackle John Barclay during the crucial Challenge Cup game

Dickson showed his pace and elusiveness to breach the Scarlets defence after 45 minutes, but Quins were then undone by another Jordan Williams-inspired Scarlets breakout that ended with Scott Williams crossing from close-range.

It was thrill-a-minute rugby as both teams were prepared to back their handling skills and put an emphasis on attacking rugby, rather than a safety-first kicking game adopted by so many teams.

Both sides had worked themselves almost to a standstill entering the final 10 minutes, but Quins, driven on by England captain Chris Robshaw, were not to be denied.

With Evans limping and not in condition to take the late penalty, Botica calmly stepped up and booted the match-winning strike.