Surrey 231 (Patel 63, Foakes 57) and 99 for 2 (Burns 48, Brooks 2-22) trail Somerset 344 and 153 (Hildreth 64, Dunn 5-43) by 167 runs
An exciting, absorbing third day's play at Guildford saw 17 wickets tumble and ended with Surrey, the 2018 champions, still believing that a remarkable first victory of the season is possible against Somerset, last year's runners-up.
Needing 267 to win, Surrey will start the final day on 99 for 2, with Scott Borthwick on 35 not out after adding a determined 72 in 27 overs for the second wicket with Rory Burns, who slog-swept left-arm spinner Jack Leach for six and also hit eight fours in an excellent 48.
Jack Brooks, who also bowled Mark Stoneman for 12 in his second over with the new ball, struck a potentially crucial blow just before the close, however, when he had Burns, Surrey's captain, caught at first slip. Scoring the remaining 168 runs Surrey require will not be an easy task.
In seam-friendly conditions, under overcast skies, Surrey had earlier resurrected their chances in dramatic fashion, Matt Dunn taking a career-best 5 for 43 as Somerset's last seven second-innings wickets fell for 39 and they were bowled out for 153.
James Hildreth's silky 64 from 80 balls, including 11 fours and by far the best batting of the day, had threatened to put the game beyond Surrey's reach after a hostile new-ball spell of 6-2-12-2 from Morne Morkel had removed openers Tom Abell and Marcus Trescothick.
Tom Banton then fell to Dunn, leg-before for 12 on the stroke of lunch, to leave Somerset 50 for 3 but Hildreth and first-innings centurion George Bartlett added 64 for the fourth wicket to put the visitors seemingly in complete control.
Ryan Patel, however, who was last out for a defiant 63 when Surrey slid from their overnight 188 for 5 to 231 all out, then shaped one into Hildreth's pads to win a leg-before appeal - the ball appearing to hit pad and then bat - and, suddenly, Somerset were struggling to build the lead of above 300 that would surely have made them overwhelming favourites.
Bartlett, on 16, edged Rikki Clarke to be athletically caught to his right by keeper Ben Foakes, and then Morkel and Dunn sparked the Somerset collapse. Still, the victory target is a stiff one on a pitch that makes batting a testing business, especially against the new ball.
At the start of the day, Craig Overton's opening spell of 5-1-12-3 had set the tone for what was to follow, with Surrey losing their last five wickets for 41 runs in 14 overs.
But Somerset's second innings began with Abell and Trescothick, respectively, caught at gully for 9 and behind the wicket for 12, although the latter clearly did not think he had touched the ball. Morkel, however, was extracting fearsome lift and, even with an older ball when he was brought back in mid-afternoon, facing the giant South African was not for the faint-hearted.
Morkel, on his return, had Craig Overton caught and bowled for 1 with his first ball - which spat from just short of a length to take the shoulder of the bat and loop so high into the air that the bowler could run forwards and take the catch just beside the batsman.
Dunn then finished off the innings in some style, having Jamie Overton caught behind for 2, trapping Steven Davies leg-before for 16 and, after tea, bowling Jack Leach for 5 and also swinging one back into Tim Groenewald's stumps to dismiss him for 10.
Craig Overton's early morning burst earned him final figures of 5 for 38 in Surrey's first innings. Will Jacks did not add to his overnight 13 before edging to second slip, Clarke steered to gully after a bright and breezy 20 and Morkel miscued to mid-on without scoring.
Jamie Overton ended with 3 for 46, with Patel skying an intended pull to mid on, and Groenewald picked up the other Surrey wicket to fall, that of Gareth Batty for a duck, as the seamers of both sides dominated the day.