Derbyshire 135 for 5 (Dal 40*) trail Glamorgan 550 for 5 dec (Lloyd 313*, Root 79) by 415 runs
They declared on a massive 550 for 5, and Lloyd's day got even better as New Zealand spinner Ajaz Patel and the Welsh County bowlers reduced Derbyshire to 135 for 5 at the close, still 415 behind.
It was also the highest score for a Glamorgan captain, while things went from bad to worse for opposite number Ben Godleman. He followed up the decision to insert Glamorgan with a duck opening the batting to set the tone for his side.
North Wales-born Lloyd started the day with a double century to his name, but plenty of landmarks ahead of him. He lost overnight partner Billy Root and Chris Cooke relatively early, but then found a solid associate in Andrew Salter.
Next up was Mike Powell's 299, the highest first class score by a Welsh-born player. A six off Thomson took him past that and the 300 mark. Then Steve James' 309, the highest Glamorgan score until this season, was in his sights.
When he reached 313 not out, off 398 balls, equalling the highest individual score at Sophia Gardens, scored by South African Jimmy Cook, Lloyd decided to call it a day and declared.
Salter finished unbeaten on 45, his highest score of the season on being recalled to the team, their unbeaten partnership worth 151, Lloyd also enjoying a double-century partnership with Root and a century partnership with Tom Bevan.
Derbyshire's bowling figures were not pretty, for instance Thomson conceding 174 runs off his 41.2 overs.
Derbyshire started batting knowing they required more than 400 to save the follow-on with Godleman in poor form and not lasting long before edging Michael Hogan to Patel at third slip.
Brooke Guest flourished briefly before becoming Patel's first victim bowling, while Wayne Madsen went next ball - meaning his number of career ducks for Derbyshire, 35, edged past the number of career centuries, 34.
Leus du Plooy edged behind off Timm van der Gugten, while at the other end Luis Reece seemed to be playing a different set of bowlers reaching his half century out of the first 63 runs scored.
However the introduction of Salter, turning the ball away from the left hander, did for Reece, caught behind for 56 as Derbyshire slumped to 75 for 5 just after tea.