Brought on with the visitors 110 for 2 after 24 overs in pursuit of 200, Barnett took 3 for 10 in his first three overs and finished with 4 for 29 from his seven overs of slow-medium seam-up.
It was an astonishing turnaround after Paddy McKeown, who hit 48 at a run a ball, and Mark Chilton, who made 39, had put on 73 for the first wicket.
The off-spinner Martyn Ball eventually made the breakthrough for Gloucestershire, trapping McKeown leg before as he attempted to sweep a full-length ball. When Chilton was run out by Tim Hancock's direct hit at the bowler's end, attempting a single to mid-on off Mark Alleyne, the likely winners still looked to be Lancashire, who had earlier allowed Gloucestershire to recover from 71 for 5 to post 199.
Yorkshire's captain, David Byas, hit a fine 87 to help the Phoenix to a three-wicket win over Worcestershire Royals in the First Division at New Road. Byas was in superb form as Yorkshire reached their target of 213 with 4 balls to spare. Worcestershire, who were put in, were indebted to the Bradford-born David Leatherdale and Gavin Haynes, who put on 133 in 24 overs for the fourth wicket.
Mark Bowen inspired Nottinghamshire Outlaws' first National League Second Division victory of the season, by 11 runs, despite a gallant attempt by Surrey's Ian Ward to ruin his day. Bowen took four wickets in the space of three overs at Trent Bridge to reduce Surrey to 81 for 6 and the Outlaws looked set to win with plenty to spare.
Ward refused to surrender and carried the game into the last available over. His 80 was the highest score of the match and included two sixes and six fours from 81 balls.