Mark Pettini kept his cool to see Essex home by five wickets with seven balls to spare against Glamorgan at Cardiff.
In an enthralling final day Essex chased down 275 for victory with openers Tom Westley and Jaik Mickleburgh hitting half centuries to give their side a good foundation.
After a couple of scares Pettini (47 not out) and Greg Smith helped to see Essex past the winning post at the end of the penultimate over. Essex took 22 points from the contest to Glamorgan's four and moved to second in the Division Two table.
Earlier in the day Glamorgan, thanks to 101 from skipper Mark Wallace - Glamorgan's first Championship century of the season - left Essex 275 to win in 70 overs.
Essex were given a fine start by Westley and Mickleburgh as the openers put on 143 for the first wicket before the latter fell lbw to Jim Allenby for 66.
But though Essex were favourites to win they did suffer their setbacks on the way. Westley was run out for 88 by Michael Hogan coming back for a second run and with 64 needed in fewer than 11 overs Ravi Bopara went for the big hit off slow left armer Dean Cosker only to be caught at long on by Stewart Walters.
Significantly, Essex sent in the big-hitting Graham Napier as they required 58 from the final 10 overs. Napier also tried to hit Cosker out of the ground only to be caught at long off by Will Bragg leaving Essex still needing 45 from 7.5 overs.
With seven runs required and 13 balls remaining skipper James Foster holed out, but Pettini and Smith saw them home.
Glamorgan had resumed the final day on 303 for six - a lead of 189.
The seventh-wicket pair of Wallace and Graham Wagg took the lead beyond 200. Wagg completed his half-century from 67 balls but his innings was ended by Reece Topley who had the Glamorgan bowler caught behind leaving them 343 for seven.
Wallace went into the 90s as the lead also went beyond 250, but with the score on 375 Napier had Cosker caught behind. Hogan stayed around long enough for Wallace to become Glamorgan's first century-maker of the summer.
Wallace's 15th first-class century came up off 171 balls with seven fours, but his fine innings ended in the next over when he was bowled playing forward to Bopara, departing for 101.
Five balls later slow left armer Tim Phillips bowled Hogan as Glamorgan were dismissed leaving the visitors their 3.92 runs an over target in the final two sessions.