Gareth Rees scored his second LV= County Championship century of the season as Glamorgan held out for a draw in their Division Two clash with Lancashire at Old Trafford.
After conceding a first-innings lead of 93, the visitors were in serious trouble after being reduced to 98-5 in their second innings just before tea on the final day, but eventually recovered to finish on 183-5.
Spinner Simon Kerrigan claimed all five scalps on the way to match figures of 12-252, with Rees (107 not out) and Nathan McCullum then putting on an unbeaten 85-run stand to end the hosts' victory hopes.
Lancashire had earlier replied to Glamorgan's first innings 474 by making 567 - their highest ever score against the Welsh side.
It proved to be a good Glamorgan debut for former Lancashire all-rounder McCullum, who was registered by the club on the morning of the first day, as he returned figures of 5-191.
Lancashire had begun the day on 423-5, Luke Procter (75) Gareth Cross (64) sharing a 56-run stand before the former was bowled by McCullum.
McCullum struck again four balls later to trap Kyle Hogg (1) lbw, while Glen Chapple was stumped for 31 by Mark Wallace off the bowling of Dean Cosker (3-133).
Cross reached 50 for the third time this season but became another Wallace stumping victim as he advanced down the pitch to Cosker on 64 to be the penultimate man out.
Kerrigan soon had Glamorgan nerves jangling, at one stage being on a hat-trick as his devastating 10-over spell saw him claim the wickets of Will Bragg (13), Murray Goodwin (10), Chris Cooke (5) and James Allenby (0).
And when he took a smart caught and bowled chance to dismiss Mark Wallace (1) in the 32nd over to claim his 12th wicket of the game, Glamorgan were effectively 5-5 and in danger of repeating their collapse against 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.