Gloucestershire 179 for 8 (Bancroft 87) beat Middlesex 169 for 7 (du Plooy 73*, Andersson 49) by 10 runs
Cameron Bancroft produced his best Vitality Blast performance with a knock of 87 from 54 balls as Gloucestershire held off Middlesex to keep their hopes of a quarter-final place alive.
The Australian, who racked up 10 fours and three sixes, shared an opening partnership of 65 from 42 with Miles Hammond to set a platform for the visitors to post 179 for eight at Chelmsford.
Despite a valiant unbeaten 73 from 52 by Middlesex captain Leus du Plooy - whose first-wicket stand of 102 with Martin Andersson was a county T20 record against Gloucestershire - his side lost six wickets for 39 and fell short on 169 for seven.
Matt Taylor claimed two for 17 for Gloucestershire, whose victory lifted them to joint fourth in the South Group table, but they will miss out if Essex avoid defeat in their final match against Hampshire on Friday.
Having won the toss and opted to bat, Gloucestershire failed to score from their first seven deliveries but Bancroft was soon into his stride, ramping Tom Helm for six before crashing successive boundaries off Noah Cornwell.
Hammond (30 from 21) also began to open up and the pair raced past 50 at the start of the sixth over before Luke Hollman made the breakthrough, with the left-hander miscuing one to point.
Bancroft advanced to his half-century in style from 31 balls, clubbing Hollman for back-to-back straight sixes, but wickets continued to fall at the other end until Ben Charlesworth joined him at 105 for four.
The pair added 46 from 29 before Blake Cullen had Charlesworth caught at point and Ryan Higgins struck twice in an over, with Bancroft holing out to long-on and Ollie Price run out by the bowler's crafty deflection onto the stumps.
Higgins finished with two for 25 from his four overs and, although Josh Shaw scrambled a boundary in the closing stages, Gloucestershire ended fractionally short of the 180-plus total that had looked likely.
David Payne delivered two tight overs at the start of Middlesex's reply but Andersson (49 from 39) enjoyed better fortune against Shaw, taking 14 from the first three balls of his over and then surviving one that clipped his off stump but failed to dislodge the bail.
Clean striking brought Andersson two maximums off Beau Webster, while Du Plooy started to accelerate after the powerplay, picking the gaps in the field as well as employing the slog sweep to good effect.
The Middlesex skipper brought up his half-century from 32 balls with a powerful straight six off Tom Smith - but Andersson narrowly missed out, pulling Matt Taylor to deep midwicket, where Hammond ran around to take an outstanding one-handed catch at full stretch.
That triggered a flood of wickets, with Max Holden miscuing to backward point and Higgins castled by a ball from Price that skidded through before Jack Davies and Joe Cracknell were both caught in the deep.
Despite some late blows from Josh de Caires and Helm, it was not enough for Middlesex as Payne closed the game out with figures of one for 26.