Essex 163 for 7 (Khushi 53, Shadab 3-28) beat Sussex 138 (Harmer 4-28, Critchley 3-28) by 25 runs
The 34-year-old offspinner struck with his first three balls after coming on in the third over as Essex easily defended a target of 164.
Sussex had already lost skipper Ravi Bopara in the first over of their reply when Harmer began to cast his spell, although he was helped by some poor shot selection by Sussex's more experienced batters.
His first victim Tom Alsop, fresh from a match-winning half-century in Sunday's win over Surrey, tried to hit over the top and instead gave catching practice to Sam Cook at short third. Shadab Khan clipped the next ball to square leg and Michael Burgess was lbw sweeping the hat-trick delivery, which would have hit middle stump.
It was Essex's first hat-trick in the format since Shaun Tait against Nottinghamshire in 2013 and the first against Sussex since Dimi Mascarenhas for Hampshire back in 2004.
With Bopara, opening in the absence of the injured Ali Orr, having picked out short-third off the fourth ball from Sam Cook, Sussex were 15 for 4 with their chase effectively over before it had begun.
Sussex's head coach, Paul Farbrace, was scathing. "It was a score we should have comfortably chased down," he said. ""We didn't have a very clear mindset when we chased and didn't bat well at all. The first four wickets were very poor dismissals.
"Ravi set the tone, it was a lazy waft outside off stump and he gave his wicket away. Tom Alsop was looking to hit a wide ball over long on, Shadab has lobbed one to square leg and Michael Burgess played the first sweep I've seen from him in two weeks. That summed up our innings.
"I don't mind people getting out but we gave our wickets away in a pretty non-aggressive way. It was a pretty lame performance, if that's the standard of how we're going to bat in the rest of the tournament we're going to lose a lot of games. We should be ashamed of that. We've now got two games in two days at the weekend but we need to bat a damn sight better than we did tonight. That was not good enough."
James Coles (35), Tom Clark (31) and Ollie Carter (27) offered some resistance but Harmer returned to have Fynn Hudson-Prentice brilliantly caught one-handed by Tom Westley off a full-blooded reverse lap to claim the fourth four-wicket return of his T20 career.
Earlier, Sussex seemed to have justified Bopara's decision to field first against his former county, restricting Essex to 163 for 7 thanks to a disciplined performance by their seven-man attack.
Pakistan leg-spinner Shadab led the way with 3 for 28, all to catches in the mid-wicket region. Shadab had been unable to bowl on his debut in last Friday's defeat to Somerset after colliding with team-mate Nathan McAndrew in the outfield and concussion protocols ruled him out of Sunday's win over Surrey.
He made up for lost time here, picking up wickets off successive balls in his second over as Critchley top-edged a sweep to mid-wicket and Paul Walter flicked the next ball to Bopara. Shadab returned to remove Westley off another mistimed leg-side swipe in his final over.
Lawrence, released from England's Test squad to play this game and tomorrow night's match against Hampshire in Chelmsford, looked in the mood when he drove his first ball onto the roof of the South Stand, but he mis-timed a pull off Mills who finished with 2 for 32 and mixed up his pace nicely.
Robin Das was dropped by Bopara on 9 and ended up with an unbeaten 31, putting on 35 at the end with Harmer (21 not out). They were crucial runs by the Essex captain, but his major impact on proceedings was still to come.