Sussex 174 (Haines 41, Potts 3-43, Conners 3-47) trail Derbyshire 505 for 8 declared (Masood 239, Madsen 111, Tomson 52) by 331 runs
Sussex are facing an uphill task to avoid defeat following a spectacular collapse on the second day of the LV= Insurance County Championship match at Derbyshire.
After the home side racked up 505 for 8 declared, Sussex imploded, losing 6 for 63, to be bowled out in the final over for 174, a daunting 331 behind.
Fast bowler Sam Conners claimed 3 for 47 and 19-year-old seamer Nick Potts marked his first-class debut by taking 3 for 43, including the wicket of captain Tom Haines, who top-scored with 41.
Haines had been the pick of his team's attack with 1 for 35 from 18 overs, ending the third-wicket stand of 292 between Shan Masood and Wayne Madsen, a Derbyshire record for any wicket against Sussex.
Masood scored a magnificent 239 from 340 balls and Madsen 111, his 32nd first-class hundred for Derbyshire, before all-rounder Alex Thomson struck a 49-ball 50.
Masood and Madsen had begun the second day as they ended the first, moving remorselessly on to eclipse Derbyshire's previous highest stand against Sussex of 274 between Billy Godleman and Luis Reece at Derby in 2019.
Madsen reached his century, surprisingly his first in the Championship at Derby for six years, when he turned Jamie Atkins off his hip for his seventh four.
He drove Haines down the ground for another but the Sussex skipper got his reward for a probing spell from the Racecourse End by beating Madsen's drive in the 16th over of the morning.
It was Sussex's first success since before lunch on day one but they did not have to wait long for the next as four wickets fell for 27.
Leus du Plooy never looked comfortable and his attempt to drive James Coles over the top ended in the hands of Haines at mid off.
Reece was caught behind as he tried to carve Atkins and Masood's superb innings finally ended in the next over. His seven-and-a-half-hour masterclass in timing and placement was ended by a reverse sweep which looped into the gloves of Pakistan team mate Mohammed Rizwan.
Masood left to applause from the Sussex players and a standing ovation but if Sussex hoped his departure would signal a quick end to the innings they were disappointed.
Thomson pressed hard on the accelerator and, with Anuj Dal, added 76 before the declaration left Sussex needing 356 to avoid the follow-on.
When Haines was dropped on eight at second slip by Madsen in the second over, it threatened to prove costly as the openers scored freely, but the dismissal of the captain sparked a collapse.
Haines was trapped half forward by Potts and after Tom Alsop was caught behind down the leg side, Conners brought one back to pin Ali Orr lbw.
Cheteshwar Pujara dabbed at a wide ball and Rizwan also edged one he did not need to play before Tom Clark charged Thomson and edged to slip.
Coles and Oli Carter showed more application but Potts brought one back to remove Coles and Steve Finn fell to Dal before Potts claimed his third victim.
A miserable day for Sussex ended when du Plooy struck with his third ball to leave Sussex with the prospect of following on in the morning.