The visitors had held the lead at the break, with Matthew Morgan kicking the Welsh side into a 12 v 6 lead at the interval. But Weir controlled the second period to give the Scottish side an important victory.
Scotland scrum-half Chris Cusiter starred for the hosts but the boot of Morgan kept them at bay in the first period.
Weir kept them in touching distance and he drew the sides level shortly after the break.
He then took his side into the lead and lock Richie Gray then touched down for the Warriors.Â
Morgan scored a try of his own late on for the Ospreys but it wasn’t enough at the death and Scott Johnson’s side suffered their first setback in the competition.