All-rounder Jamie Dalrymple struck a match-saving 74 as Glamorgan salvaged a draw from the clutches of defeat to thwart Northamptonshire at Wantage Road.
Dalrymple's knock boosted Glamorgan's second innings total up to 238 leaving Northants just 38 to win from five overs.
However, the home side were guilty of playing one shot too many as they fell 10 runs short of a victory which would have given their promotion charge a major boost.
Glamorgan began day two on 28-1, and, after a steady 42-run partnership from Richard Grant and David Hemp, both batsmen were dismissed in the space of two runs.
Former Middlesex all-rounder Dalrymple and Mike Powell steadied the ship with a 31-run partnership as Glamorgan moved to 95-3.
And even when Powell was trapped lbw by Monty Panesar, Dalrymple and Wallace added another 85 runs as the match seemed destined for a draw.
However, the visitors capitulated from 180-4 to 238 all out as Panesar took 4-83 on his return to county action.
Northants had five overs to acquire the 38 runs required for a precious victory, however Alex Wharf struck twice to quell the run-rate and the hosts fell agonisingly short.
The draw sees Northants sit in third place - four points behind Warwickshire, however the Bears do have one game in hand on their promotion rivals.
Lance Klusener smashed his highest ever first-class score as Northamptonshire continued to dominate on day three of their must-win clash with Glamorgan.
The former South Africa all-rounder, who is deputising as captain due to an injury to Nicky Boje, belted 202 not out before declaring the home side's first innings on 488-7.
Niall O'Brien also reached three figures, moving on from his overnight 99 not out to score his second Championship ton of the season.
The Irish wicketkeeper was eventually dismissed for 168 having put on 211 with Klusener, who became the first Northants batsman to pass 1,000 runs for the season.
Monty Panesar managed 30 not out in a 106-run stand with his skipper before Glamorgan were left to negotiate a testing period before close.
The eight overs that were squeezed in before bad light ended play early saw Gareth Rees hit Johan van der Wath straight to Klusener at mid-on, the Welsh county finishing up on 28-1 still 173 runs behind.
Ireland wicket-keeper Niall O'Brien faces a restless night's sleep after his unbeaten 99 brought Northamptonshire back into the Division Two promotion race against Glamorgan at Wantage Road.
The 26-year-old finished one run away from a century after a 110-run partnership with stand-in skipper Lance Klusener.
The Proteas all-rounder finished on 62 not out as he and O'Brien rescued Northamptonshire from 41-2 to 213-4 after they skittled the visitors out for 287.
Adam Shantry was the pick of the bowlers for Glamorgan taking 3-49 but received little support as the hosts moved into a commanding position.
Northants paceman Johan van der Wath picked up where he left off at the end of day one removing former Northamptonshire pacemen Shantry for one to claim his fifth victim and bring Glamorgan's innings to a close.
Openers Stephen Peters and O'Brien stormed to the middle attempting to scythe down and surpass the respectable Glamorgan first-innings total.
However, after mustering just one run from 24 balls, Peters found himself back in the pavilion after he edged to David Hemp off the bowling of Shantry.
The Glamorgan left-armer was clearly buoyed by his early scalp and quickly trapped incoming batsmen Rob White leg before wicket on eight as Northamptonshire slumped to 41-2.
O'Brien and David Sales steadied the ship shortly after doubling the total to 85 but further misery ensued when the latter holed Alex Wharf to Mark Wallace for 23.
O'Brien went past his 50 just before lunch, and even after Riki Wessels (10) perished shortly after the interval, the Irishman - ably supported by Klusener powered the hosts into a commanding overnight position.
Glamorgan were indebted to Mark Wallace's highest score of the season as they ended day one at Wantage Road on 286-9.
The wicketkeeper made a gutsy 72 to help the visitors recover from the perilous position of 55-4 against promotion-chasing Northamptonshire.
Having chosen to bat first the Welsh county struggled against the new ball, Richard Grant and David Hemp both departing with the score on three.
Michael Powell and Gareth Rees, who made 53, added 50 for the third wicket before Powell fell to the bowling of Andrew Hall for 32.
Hall followed that up by getting rid of Jamie Dalrymple and when Rees fell shortly after reaching his half century, Glamorgan were five down for just 126.
However Wallace proved the perfect man for a crisis, bringing up his third 50 of the season from 78 balls before falling to a stunning catch by Hall at first slip off the bowling Monty Panesar.
The England spinner also dismissed Alex Wharf for 36 but Robert Croft continued the tail-end defiance with 43. Bad light ended play early with the visitors nine down.