Glamorgan 286 and 296 (Wallace 78, Rudolph 56, Bragg 54) beat Essex 319 (ten Doeschate 117, Foster 64, Wheater 59, Meschede 5-84) and 252 ( Chopra 79, Hogan 5-45, Van der Gugten 4-56 ) by 11 runs
Essex's players set off for a night on the town to celebrate their Division Two title success after suffering only their third Specsavers County Championship defeat of the summer.
Promotion to Division One having been sealed on Tuesday when they garnered the five bonus points required to put them in an unassailable position, they found Michael Hogan in party-pooping mood with five wickets for 45 to leave Essex 11 runs short of victory.
It was the Australian's second five-wicket haul in successive games, taking him to 44 Championship wickets for the season. He was well supported by the parsimonious Timm van der Gugten, who claimed four for 56 from 29.5 overs, and ended Essex's obdurate last-wicket partnership with 19 balls to spare.
At one point, Varun Chopra looked as if he might carry Essex to a seventh win on his own when he rattled up 79 out of the 138 scored while he was at the crease. His seventh Championship score in excess of fifty this season - the other six were for Warwickshire - came from 128 balls with 10 fours.
But with wickets falling all around him, and no one sticking around long after he had gone, Essex were always ahead of the rate but without enough men to see them over the line.
Essex had been set 264 to win in a minimum of 91 overs, and the openers put on 92 fairly comfortably in 26 overs before three quick wickets fell. Nick Browne departed to the last ball before lunch, caught in the slips by Will Bragg off van der Gugten for 30. When he reached 20, flicking Morgan off his legs, he became the third Essex batsman to 1,000 Championship runs for the season.
Tom Westley, who had passed the milestone in the previous game against Worcestershire, lasted just three balls after lunch before he fell lbw to Michael Hogan without score. And Essex lost another wicket in the immediate post-lunch period when Ravi Bopara was pinned in his crease by one from van der Gugten that kept low.
At the other end, Chopra was compiling his highest score since his return to his first county. He despatched a full-toss from Kiran Carlson for his eighth four to reach fifty from 73 balls. He was particularly strong through the offside.
But he was fourth out just after an involuntary edge by Dan Lawrence had taken Essex past the halfway point with 43 overs gone. Chopra was beaten by an inswinger from Hogan, who then accounted for Lawrence five overs later to another that swung in and took middle and leg.
Essex were less fluent in an afternoon session of 38 overs in which they added just 62 runs. But ten Doeschate joined Adam Wheater just before tea and together they put on 40 in 12 overs before the captain became Hogan's fourth victim, caught behind by Mark Wallace for 23.
Wheater played second fiddle in the partnership, and it was not until the 58th ball he faced that he registered a boundary, stroking van der Gugten through the covers. But he then scooped a return into Hogan's hands to leave Essex 64 runs away from victory with three wickets left.
Glamorgan gave Graham Napier a guard of honour as he came out with runner Lawrence to begin his last innings after a 20-year career with Essex. He contributed 12 in an eighth-wicket stand of 23 with James Foster before he went lbw to van der Gugten. Foster then chased a wide one from Meschede to toe-end it to the wicketkeeper.
David Masters received a similar welcome to Napier after confirming his retirement at the end of the season to the crowd at lunch-time. They were equally generous to the last pair when they dropped fairly routine catches in successive balls - Masters at short extra cover by Jacques Rudolph and Jamie Porter in the slips by Aneurin Donald. Van der Gugten took his fourth wicket when he yorked Porter to end a 23-run stand for the last wicket.
Essex needed just 14 deliveries with the new-ball in the morning to take the remaining Glamorgan wicket. Not that they required any assistance from their opening bowlers, Masters and Bopara - Wallace decided to chance a second run to Lawrence on the backward square boundary and was run out by a long way.
Wallace had added three runs to his overnight score to finish on 78. His 91-ball innings had been crucial in helping Glamorgan recover from 163 for seven, at which point they had been only 130 ahead.