Glamorgan kept alive their hopes of reaching the Friends Life T20 quarter-finals with victory over Worcestershire at the Swalec Stadium.
Murray Goodwin and Jim Allenby helped the Welsh county on their way thanks to half centuries while Ben Wright produced a match-winning cameo.
Set 158 to win, the hosts eventually won by five wickets with five balls to spare to resurrect their hopes of reaching the knockout stages.
Glamorgan went into the match having lost three on the trot after they had won all four of their first group games.
But they suffered three setbacks in the opening eight overs as they slipped to 46-3 in response to Worcestershire’s 157-6.
The home side lost Mark Wallace in the second over before Chris Cooke was caught at third man and then skipper Marcus North was trapped leg before by Moeen Ali.
Even with Allenby looking in good form and with Goodwin in support they needed 100 from 10 overs.
Allenby took the pressure off by hitting a six off Shaaiq Choudhry and that started a good spell for Glamorgan as he and Goodwin shared a partnership of 57 off 43 balls for the fourth wicket.
But Allenby, who reached his 50 from 42 balls, holed out off Gareth Andrew. At that stage Glamorgan needed 53 from 32 balls, which became 37 required from the final four overs.
Goodwin brought up his 50 from 30 balls but was caught off the last ball of the 17th over to leave Glamorgan still needing 18 from the final 12 balls.
But Wright, 22 not out from 12 balls, produced a productive penultimate over scoring 13 from the first four balls which meant Glamorgan needed only one to win from the final over.
After Worcestershire won the toss Thilan Samaraweera was the mainstay of the their innings with 65 from 42 balls with eight fours and a six.
After being restricted to only 27-1 in the opening six overs, bowled exclusively by the seamers on a greenish pitch, Samaraweera dominated a second wicket stand with Alexi Kervezee worth 91 in 10.1 overs.
That was after Ali was caught at cover off Wagg, who ended as Glamorgan’s star bowler with 3-15 from his four overs.
The visitors had looked well set thanks to Sri Lankan Samaraweera before he was run out by a direct hit from Goodwin in the 14th over with Worcestershire 103-2.
West Indian Andre Russell was bowled from an inside edge from Wagg before Nathan McCullum picked up the wicket of Kervezee (44 from 40 balls) in his final over.
Wagg claimed a third wicket when Joe Leach was caught on the deep mid-wicket boundary before Ben Cox in Michael Hogan’s final over.