Sussex 415 (Haines 117, Moriarty 5-154) and 109 for 9 (Moriarty 6-60, Virdi 3-31) lead Surrey 388 (Burns 103, Jacks 84*, Overton 55, Borthwick 50) by 136 runs
Spinners Dan Moriarty and Amar Virdi put the skids under Sussex's second innings at the Kia Oval to reduce them to 109 for 9 in a frenetic final session of the day and bowl Surrey dramatically back into the final Bob Willis Trophy fixture.
Moriarty took a career-best 6 for 60 from 16 overs and Virdi 3 for 31 from 13 and it took a 40-run ninth wicket partnership between former Surrey fast bowler Stuart Meaker and Jack Carson to rescue Sussex from the depths of 62 for 8.
Meaker remains on a fighting 32 not out, but Moriarty had Carson caught at slip for 6 three overs from stumps and tomorrow Sussex will resume with an overall lead of 136.
But Surrey will hope they are not chasing much more than 150 in the final innings on a dry surface as they seek a first win of the competition, following four defeats in the south group, even after earlier battling their way to 388 in reply to Sussex's first innings 415.
It was a stand of 112 in 24 overs for the seventh wicket between Will Jacks and Jamie Overton which first rallied Surrey on day three, after they had initially slipped to 256 for 6 after resuming on 171 for 4, but Sussex still had a halfway lead of 27.
That soon didn't seem much of an advantage, however, as 20-year-old slow left-armer Moriarty took the new ball, alongside Overton, and whistled out the first three Sussex batsmen.
Aaron Thomason even survived an edge to Rory Burns at slip before falling later in Moriarty's opening over for 9 when another delivery turned sharply for keeper Ben Foakes to pull off a smart stumping.
Tom Haines had just driven Moriarty for six in his third over when, to the very next ball, he advanced again but miscued an ill-judged push-drive high to Hashim Amla's right at mid off. The veteran former South Africa batting star made good ground to dive and hold a tremendous catch.
Moriarty, in the same over, then had Harry Finch held at slip by Burns for 13 and 31 for 3 soon became 58 for 6 as off spinner Virdi, replacing Overton, struck three times in his first four overs to send back Ben Brown, Delray Rawlins and James Coles.
Virdi, already Surrey's senior spinner at the age of 22, had Brown leg-before on the back foot for 7 and Rawlins caught at backward point trying to force a ball which turned and bounced. The 16-year-old debutant Coles, Sussex's youngest first-class cricketer, was dropped at second slip on 1 off Moriarty before, on 10, falling lbw to one from Virdi that scuttled into his pads.
Moriarty completed a maiden ten-wicket match haul, in just his second first-class game, by spinning one out of the footholds to have left-hander George Garton leg-before for 1 in his seventh over and then, in his next over, seeing David Wiese lift a drive straight to short extra cover.
Earlier, Jacks finished unbeaten on 84 from 119 balls, with ten fours, but Surrey's first innings ended in something of a flurry of wickets too as 19-year-old off spinner Carson took the last three tailend scalps to earn himself deserved career-best figures of 5 for 93 from 34.5 impressive overs.
Overton, on his Surrey red-ball debut, made 55 from 78 balls with a six and eight fours before mis-hitting Wiese's medium pace to mid on and Surrey lost their last four wickets for 20 runs as Carson had James Taylor caught at long off for 3 before yorking Moriarty for 1 and having last man Virdi caught off bat and pad at short leg two balls later.
Sussex had also bowled well in the morning session to restrict Surrey from their overnight 171 for 4 to 259 for 6 at lunch, with Coles bowling Foakes for 39 with his tenth ball in first-class cricket after being given two overs immediately before the interval.
Coles was mobbed by his teammates after his magic moment, producing a classic slow left-arm delivery which pitched on middle and took Foakes' off stump out of the ground as one of county cricket's most in-form batsmen groped forward defensively and was beaten by the turn.
Rawlins had already struck an important blow for Sussex with his slow left-armers, claiming the prized wicket Amla, who had started the day on six but was leg-before for 26 in the 23rd over of the morning after battling for more than an hour against Carson and the accurate fast-medium of both Henry Crocombe and Wiese.
Bermudan all-rounder Rawlins, introduced to bowl his left-arm spin in the 67th over of the innings, straightened one just enough to beat Amla's forward defensive and hit him on the back pad in front of off stump.
Foakes batted in composed and responsible fashion before succumbing to Coles, but after lunch Jacks and Overton counter-attacked in increasingly breezy fashion to bring Surrey back into the match.