South Australia 5 for 330 (McSweeney 94, Carey 67, Head 55, Kelly 53*) beat New South Wales 322 (Hughes 139, Patterson 52, McSweeney 3-51, Thornton 3-67) by eight runs
But NSW, bowled out for a state-record 76 in a winless campaign already this season, were purring to victory when their top order responded.
Needing 15 off as many balls, Hughes (139 off 127) looked set to steer the hosts home until he was run-out at the bowler's end when McSweeney inadvertently deflected the ball onto the stumps.
Nathan Lyon was then out lbw on the first ball he faced and, needing nine off the final over, Ben Dwarshuis was dismissed on the first delivery from former NSW quick Harry Conway.
"I shouldn't be backing up as much as I was...I should have just stayed in my crease," Hughes said. "If I'm there at the end we get the runs.
"We always had it pretty much in the bag, guys coming out scoring at a nice rate and never got above eight an over. No-one was stressed out; they needed to bowl us out to win the game and they did that, so hats off to them."
Earlier McSweeney drove and swept Lyon, both conventionally and unconventionally, with great impact as he shared 110 and 96-run stands with Head and Carey respectively.
Kelly pushed the Redbacks well past 300, a huge six over mid-on bringing up his 50 from the final ball of the innings.
McSweeney's knock followed 75 in his previous one-day innings and comes after an unbeaten 99 earlier in the season gave South Australia their first Sheffield Shield win in two years.
"The game ebbed and flowed all day, luck we came out on top when it was likely Hughesy was going to get the Blues over the line," McSweeney said.
Head, a contender to replace Aaron Finch at the top of the order for Australia in 50-over cricket, was filthy with himself at an opportunity missed.
He passed 50 for the first time since his first Shield innings this season but was no sooner inside edging as he charged and attempted to loft Liam Hatcher over mid-on.