Nigel Pearson was more than happy to win ugly and praised his side for showing grit and determination as Bristol City finally ended their poor run of form away from home.
It didn't come without riding their luck at times with Dan Bentley making an 83rd-minute penalty save to deny Bradley Dack from opening the scoring from the spot.
Han-Noah Massengo was the guilty party, alleged to have pulled back him man in the box, but it counted for nothing when Andi Weimann scored a dramatic last-minute winner to send the 480 travelling fans into raptures.