Gloucestershire 181 for 9 (Hammond 59, Cullen 3-38) beat Middlesex 179 for 6 (Eskinazi 54, Price 3-21) by two runs
Matt Taylor successfully defended seven from the final over as Gloucestershire claimed their first win of this season's Vitality Blast with a narrow success against Middlesex at Merchant Taylor's School.
The left-armer conceded just four, with former Gloucestershire all-rounder Ryan Higgins needing three off the final ball and attempting a paddle shot that led to him being run out for 24.
Middlesex, who remain winless in the tournament, had looked set to break their duck after skipper Stephen Eskinazi struck a half-century and Higgins and Luke Hollman shared a sixth-wicket partnership of 55 from 30 balls.
But they fell just short of the Gloucestershire total of 181 for nine, centred around Miles Hammond's knock of 59 from 42.
Eskinazi, Middlesex's captain, did not disguise his annoyance. "I think we probably played almost the perfect T20 game, especially an outground T20 game, up until 12 balls to go. When you're four down, with two of your most senior players at the crease, 12 off 12 - you probably win that game 999 times out of a thousand.
"It stings for sure. I don't think I've ever seen that before, not with people as senior as that at the crease and I don't think the guys need me to tell them how much it hurts the team. It's going to be a tough one to bounce back from. I'm very disappointed."
Asked to bat after losing the toss, Gloucestershire began briskly with Grant Roelofsen taking 18 from Tom Helm's second over, but the opener's knock of 34 from 19 came to a tame end when he patted Higgins' half-volley to mid-off.
Higgins, playing against his former county for the first time since his return to Middlesex, was expensive overall - as was his dropped catch at long-on when Hammond, with just nine to his name, took on Hollman.
The left-hander capitalised on that let-off, launching successive Blake Cullen deliveries over the fence and driving Hollman over the top for six more as he passed his half-century before chopping Cullen to point.
Joe Cracknell pouched the catch, his third of the innings - and a routine one by comparison with the second, when he raced from deep midwicket to long on and dived for a spectacular one-handed grab that removed visiting skipper Jack Taylor.
Cullen also claimed the wicket of the big-hitting Marchant de Lange to finish with three for 38, while Martin Andersson took two for 30 as Graeme van Buuren's unbeaten 28 from 19 nudged Gloucestershire above 180.
Middlesex kept up with the required run-rate of nine at the start of their pursuit, with Cracknell sweeping Tom Smith's first delivery to the boundary and bisecting the leg-side fielders perfectly to collect four more off David Payne.
He and Eskinazi scored freely as they accumulated a partnership of 78 from 48 but Cracknell, having reverse-swept Smith for four, was lbw for 42 from 28 attempting to repeat the shot later in the over.
Eskinazi began to impose himself on the Gloucestershire spinners, pumping van Buuren over long-on for two sixes, but Ollie Price boosted the visitors' prospects with a single over of off-breaks that accounted for both Max Holden and Pieter Malan.
De Lange backed up Price's double strike in the next over, firing one through Eskinazi's defences to take out his middle stump, but Hollman and Higgins stopped the rot with their spirited counter-attack.
Hollman took two fours off Matt Taylor in quick succession and thumped Payne back down the ground for another to reach 39 from 19 before he was bowled by Price, who recorded his best T20 figures of three for 21.