The hosts looked to be heading for a third consecutive defeat when Jacob Murphy headed in his second of the season in the 83rd minute.
But Tony Mowbray's team mounted an incredible fightback, with Tosin Adarabioyo's first goal for the club levelling matters in the 88th minute before Buckley sent Ewood Park into raptures, netting with a deflected effort in stoppage time.
There was still time for Christian Walton to pull of an outstanding save to end Blackburn's six-match winless streak.
It also means Wednesday's four-game unbeaten run is at an end.
Former Germany international Lewis Holtby returned as Blackburn made three changes from the side that lost at Deepdale; the Owls made two alterations, including Keiran Lee for the injured Barry Bannan.
Wednesday had designs on the top two before play though and Kadeem Harris underlined their intent in the 17th minute, forcing Walton into a sharp near-post save.
The Owls went even closer on the half-hour when Dominic Iorfa's diving, goalbound header was hooked clear by Adarabioyo.
Rovers should have taken the lead early in the second half when Gallagher's inch-perfect cross found Adam Armstrong at the back post, who saw his effort blocked, before Lewis Travis' follow-up shot was sensationally repelled by Westwood at point blank range.
Armstrong weaved onto his left foot and unleashed a 20-yard drive 19 minutes from time but Westwood made another telling contribution.
And the Owls stopper made an even better save moments later as he tipped Joe Rothwell's bullet header over the crossbar.
Walton was called into action at the other end, brilliantly tipping a low drive from Harris away as the game started to stretch.
The game could have gone either way but Wednesday looked to have made the telling breakthrough seven minutes from the end when Morgan Fox's cross was met at the front post by Fletcher whose shot came back off the crossbar and fell invitingly to Murphy, who nodded into the empty net from a yard out.
But Rovers were not to be denied and equalised two minutes from the end when Adarabioyo met Elliott Bennett's searching cross and his towering header looped over the despairing Westwood.
Astonishingly, Blackburn snatched an injury time winner through Buckley, whose 18-yard drive took a huge deflection and wrong-footed Westwood.
Fernando Forestieri's deflected long-range effort struck a post deep into added time, before Walton produced a match-winning save to deny Sam Hutchinson at the death.