Derbyshire 362 (Hughes 103, Critchley 54*, Slater 52, Salter 4-105) and 147 for 8 (Madsen 55, Hogan 4-43) drew with Glamorgan 283 (Salter 72*, Cook 69, Palladino 5-69) and 403 for 7 dec (Carlson 152, Khawaja 126)
Glamorgan were denied their second win of the season by the Derbyshire tailenders at Swansea, where Tony Palladino - who faced 108 balls for his unbeaten 30 - and Duanne Olivier batted out the final 14.3 overs to earn the visitors a draw.
When Derbyshire lost their eighth wicket, Glamorgan were favourites to win but, with stubborn resistance and some good fortune, the visitors held out.
Glamorgan had resumed at their overnight score of 201 for 3, making rapid progress in the opening session as 107 runs were scored in the first hour at the rate of six runs an over. Kiran Carlson and Usman Khawaja shared a record partnership of 289 for the fourth wicket, the highest for any wicket for Glamorgan against Derbyshire, surpassing the previous record set by Mark Cosgrove and Michael Powell.
Khawaja was to the first to reach his century, and he also became the first Glamorgan batsman to score successive hundreds in his fist two games for the club. Carlson reached his landmark shortly afterwards before racing to his next fifty from only 20 deliveries.
Both batsmen surrendered their wickets in the quest for quick runs, and after David Lloyd had struck a brisk undefeated 43, Glamorgan declared to leave Derbyshire a target of 325 from a minimum of 63 overs.
The visitors were soon in trouble as Harvey Hosein had his middle stump uprooted in Michael Hogan's first over, then Ben Slater was lbw to Andrew Salter - also in his first over - with Derbyshire struggling at 18 for 2.
Much depended on Derbyshire's best batsmen Wayne Madsen, and he responded with some aggressive shots, notably against Salter, whom he struck for three fours in one over. However, Alex Hughes was the next to go when he edged Hogan, who had changed ends, to second slip.
Derbyshire resumed after tea on 77 for 3, with 40 overs remaining, but there then followed a flurry of wickets. Ben Godleman was the first to go when he chipped Prem Sisodiya to midwicket, before the 19-year-old debutant took the vital wicket of Madsen, who was caught at backward point.
When Matt Critchley became Hogan's third victim, Derbyshire had slumped to 93 for 6, but Gary Wilson and Palladino provided stubborn resistance for 15.2 overs. Wilson faced 72 balls before he was lbw to Lukas Carey for 26, a decision he clearly didn't agree with, as he stalked back to the pavilion.
Hamidullah Qadri quickly followed for a pair in the game to give Hogan his fourth wicket - but there was further frustration for Glamorgan as Olivier joined Palladino to defend on a fourth-day pitch that offered little to the bowlers.