Wales edge Queensland Reds to snap long losing streak
But they made a meal of it, squandering a 17-point lead to ensure a nail-biting finale against the Super Rugby franchise.
Warren Gatland's struggling side came into the match in Brisbane on the back of consecutive Test defeats to the Wallabies and without a win this year.
They remain one game away from a record 10th straight Test loss.
Gatland's outfit restored some pride against a Super Rugby team missing some of its top players, who are on Australia duty.
Rugby league convert Regan Grace crossed in the first half, as did Archie Griffin, Christ Tshiunza and Rio Dyer, to give Wales a 24-14 lead at the break.
But after an early second-half try to Nick Tompkins, they lost focus as the Reds stormed back to lead 35-31 before Hardy's exploits at the death sealed the win.
"It was a good game of rugby to watch I'm sure, but it was a bit too close for comfort at the end there for my liking," said skipper Gareth Davies, who took the armband when Cory Hill pulled out before the start of the game for personal reasons.
"They gave us a hell of a game. We knew all week this wasn't going to be easy. Luckily we came out on the right side."
The hosts found themselves on the back foot after just four minutes when Griffin barged over for a converted try.
But they responded with a period of intense pressure which was rewarded when Richie Asiata dotted down from a rolling maul and James O'Connor added the extras.
Undeterred, Wales hit straight back with Grace darting over in the corner and Rio Dyer bagging another try minutes later, collecting a cross-field kick.
Asiata got his second of the game for the Reds with Wales' Evan Lloyd in the sin-bin, but when the hooker returned the visitors stepped up again and Tshiunza's try gave them a 10-point cushion at the interval.
They breached the home defence again early in the second-half with Tompkins finding a gap.
But the Reds came roaring back with three successive tries -- to Asiata and a brace for Mac Grealy -- to take a 35-31 lead with nine minutes to play before Hardy ruined the upset.