Shane Snater's aggressive unbeaten 65 secured Essex a thrilling one-wicket LV= Insurance County Championship win over Yorkshire inside three days at Headingley.
The visitors took eight wickets during the first half of the day to bowl Yorkshire out for 252 in their second innings, including three apiece for leg-spinner Matt Critchley and seamer Jamie Porter, who returned figures of 4-64.
But they later slipped from 51-2 to 64-6 in a crazy 13-ball evening spell in which veteran seamer Steve Patterson struck three times for the hosts.
Patterson, who has not been offered a new contract beyond this season following 17 years of first-team cricket, finished with a brilliant 5-46, including the ninth wicket with the scores level.
But Snater heaved Ben Coad through midwicket to secure 20 points for his side - their sixth win of the campaign.
Snater, who also hit 46 in the first innings, successfully turned Essex defence into attack amidst a nail-biting finish. Essex are now four points behind Lancashire with two to play.
Battling Yorkshire, meanwhile, lost for the fourth time this season and are not yet out of relegation danger after only taking three points. Their position will be clearer when Warwickshire versus Somerset finishes on Thursday.
The White Rose started the day on 87-2 in their second innings, trailing by four.
As impressive as Patterson was with the ball, Coad's third-day contribution was just as significant in taking this game down to the wire. But perhaps not in the way you would expect.
The seamer, who earlier in this match took his 200th first-class cricket, crashed an entertaining 69 off 70 balls with 10 fours and a six over midwicket to give himself and his bowling colleagues something to work with.
Five morning wickets, including two for Critchley, left Yorkshire 158-7 and with a lead of 69.
Fledgling opener Fin Bean had been trapped lbw by a Porter yorker for 53, his maiden first-class fifty in only his second game.
But Coad changed things. He dominated an eighth-wicket partnership of 80 with Matthew Revis, the highest stand of the match.
Coad was then bowled by one that skidded through from Critchley, while Porter claimed two of the last three wickets to fall to leave Essex with 52 overs of batting to do before the close.
Given Essex's caution in the early stages of their chase, Yorkshire's hopes remained high.
Jordan Thompson had Nick Browne caught at third slip before tea and Tom Westley sliced Patterson to backward point shortly after, leaving the score at 35-2 in the 20th over.
Then came the turnaround as Patterson wheeled away from the Howard Stand End and Coad from Kirkstall Lane.
Patterson yorked Dan Lawrence playing to leg and superbly held a one-handed diving return catch later in the 26th over.
Coad then trapped Feroze Khushi lbw and Patterson got a flashing Sir Alastair Cook caught at slip. Essex were six down 98 short of their target.
By now, Essex had realised they had to break the chain and started to attack. And it worked, but not before George Hill had Adam Rossington caught at short midwicket.
Snater powered Patterson for six over long-on and later showed finesse by twice steering Thompson to the third-man fence.
Snater, who faced 51 balls, dominated an eighth-wicket partnership of 63 with Ben Allison and reached a 38-ball fifty, by which time Essex needed only 20 and the game was seemingly back in their control.
But Coad got Allison caught behind and then Patterson dismissed Sam Cook, leaving Essex 161-9 and the scores level. But Snater held his nerve to hit the winning run to cap a remarkable conclusion.
Comments: Our rules
We want our comments to be a lively and valuable part of our community - a place where readers can debate and engage with the most important local issues. The ability to comment on our stories is a privilege, not a right, however, and that privilege may be withdrawn if it is abused or misused.
Please report any comments that break our rules.
Read the rules here