The Pitmen had raced into a 21-3 lead early in the second half, but Nant Conwy refused to give up hope, and came within inches of snatching a dramatic win.
Penallta took the lead inside 10 minutes when outside half Jon Wright poked a precise crossfield kick for winger Steven Davies to pluck out of the air and sidestep his way over the line. Wright added the extras, but there was little else to excite a boisterous crowd for most of the rest of the half, with the score remaining 7-0 in Penallta's favour until two minutes before the interval, when Nant Conwy full back Carwyn ap Myrddin slotted a penalty.
But Penallta ended the half as they had started it. Awarded an injury-time penalty, they elected to go for touch rather than restore their seven point lead by kicking the points, a gamble which paid off when flanker Ross Morgan touched down following a powerful forward drive.
Morgan grabbed his second of the afternoon 13 minutes into the second period after a Nant Conwy clearance kick was blocked. Morgan was in the best position to gather, reacting sharply to gather the ball on the bounce without breaking stride, and swallow diving over the whitewash.
At that stage the Pitmen could be forgiven for starting to plan the post-match celebrations, but the Division One North side had other ideas.
Replacement Llywyrch ap Myrddin took advantage of a lagging Penallta defence to sprint across the line for a well-worked try, and with nearly 20 minutes remaining, Nant had narrowed the gap to 21-8.
Moments later, the Pant Carw-based side squandered a glorious opportunity for another score when ap Myrddin made another blistering break down the left flank, but his popped inside pass fell loose with the Pitmen's defence nowhere.
The eventual winners also had to survive a period when they were reduced to just 13 players, with flanker Rhys Silcox and replacement prop Luke Purnell sent to the bin by referee Greg Morgan within minutes of each other.
Nant Conwy took advantage of their temporary numerical advantage by crossing for their second try through Purnell's opposite number Gareth Jones, who sniped over from close range.
And his side continued their pressure, the clock ticking past 80 minutes with Nant Conwy camped under the Penallta posts and winning a series of scrums. Referee Morgan looked to be on the verge of awarding what would surely have been a winning penalty try, but with the Pitmen restored to their full complement of forwards the ball was turned over and the plate was secured.
Penallta coach Matt Tucker paid tribute to his victorious side, calling the success a "huge achievement"."We have been working really hard all year," said Tucker.
"The league went awry by a few points but today is massive, it's the biggest trophy the club will ever win."
He singled out man of the match Jon Wright for particular praise, who has been playing outside half for less than a year.
"Jonny Wright was outstanding," added Tucker.
"He was converted to outside half this year. It's a phenomenal achievement for him to pick up man of the match in this arena.
Nant might have had a penalty try from their series of scrums late on, but captain Elgan Davies refused to use that as an excuse.
"We are not going to complain about the ref. They just had too much ball in the first half," added Davies.