Barrett broke through the Blues' line at midfield and brilliantly evaded a host of lunging defenders before offloading to captain Conrad Smith, who charged 30 metres to cut the deficit to a point with his second try.
Barrett then kicked truly from a slight angle to hand the Hurricanes their third win of the Super Rugby season after they appeared destined to slump to an ill-disciplined loss.
"They did really well out to shut us out and nine times out of 10 they would have ended it," Smith said in a post-match interview. "We've got weaknesses, we're the first to admit it (but) we're patient and we wait for opportunities."
The Blues had taken a 25-19 lead in the 58th minute after kicking three straight penalties after the break, and kept the Hurricanes scoreless for over 20 minutes before finally succumbing to the visitors' pressure.
The Hurricanes held a 19-16 lead at halftime after three first-half tries but it was discard Ma'a Nonu who scored the first try against his former team.
The All Black inside centre barged over the line next to the right post from three metres out in the 14th minute after flyhalf Piri Weepu drove the ball forward to the line.
Lachie Munro's conversion put the Blues 10-0 up, but the Hurricanes hit back within seconds of the re-start, as fullback Andre Taylor touched down on the right after evading four defenders on a breathtaking angled run from the halfway line.
Winger Cory Jane scored the Hurricanes' second try in the 33rd minute after a terrible mistake by fullback Munro in the Blues' 22-yard line.
Munro collected a kick downfield but slipped as he tried to evade a tackle and Jane scooped up the loose ball before fending off Weepu to bolt over the line at the righthand corner.
Smith gave the Hurricanes a 17-16 lead just before half-time as he grubbed a kick along the ground and collected a fortuitous rebound before streaming over right of the posts.
The Hurricanes' hopes were all but dashed by a series of infringements deep in their own territory.
Munro kicked six penalties and three in the second half to give the Blues a six-point break going into the last quarter, but the home side was caught dead by Barrett's moment of inspiration as they slumped to their fourth loss of the season.