Gareth Rees scored his second LV= County Championship century in as many matches to help Glamorgan secure a draw against Division Two leaders Lancashire at Emirates Old Trafford.
After conceding a first innings lead of 93, the visitors were in serious trouble at 98 for five in their second innings just before tea on the fourth afternoon with England Lions spinner Simon Kerrigan claiming all five on the way to match figures of 12-252.
But Rees and one-time Lancashire all-rounder Nathan McCullum put on an unbeaten 85-run stand to secure a share of the spoils, with the former finishing on 107 not out as Glamorgan reached 183 for five.
Earlier, Lancashire replied to Glamorgan's first innings 474 by making 567 - their highest score against the Welsh side.
It proved to be a good Glamorgan debut for McCullum - who was only registered by the club on the first morning - as he claimed a five-wicket haul.
The New Zealand international began by bowling Luke Procter, who shared a 56-run stand with wicketkeeper Gareth Cross, for 75 after Lancashire started the day on 423 for five. McCullum struck again four balls later to trap Kyle Hogg lbw for one.
Skipper Glen Chapple swatted a four through midwicket off Dean Cosker to take his side past Glamorgan's first-innings total in the 150th over before being stumped by Mark Wallace off the same bowler for 31.
Cross brought up his third half-century of the season but became another Wallace stumping victim as he advanced down the pitch to Cosker on 64.
Arron Lilley, making his first-class debut for Lancashire, added an unbeaten 35 before McCullum claimed his fifth when Kerrigan was caught by Alex Jones.
On a pitch which offered little for the seamers, spin was always going to be the key to any Lancashire win and after being introduced into the attack in the sixth over, Kerrigan soon had Glamorgan nerves jangling.
At one stage the 24-year-old was on a hat-trick as his devastating 10-over spell saw him claim the wickets of Will Bragg for 13, Murray Goodwin for 10, Chris Cooke for five and James Allenby off the following ball for a duck on the way to the second 10-wicket match haul of his career.
When Kerrigan took a smart caught-and-bowled chance to dismiss Mark Wallace in the 32nd over, Glamorgan were effectively five for five and in danger of collapsing in similar style to when they lost to Lancashire on the final day at Colwyn Bay earlier this year.
However, Rees and McCullum saved the visitors, who claimed eight points to Lancashire's seven.