Goals from Simon Makienok and Daniel Johnson delivered a 2-1 win at Ashton Gate.
Makienok fired North End ahead in the first half but the Robins looked to have grabbed a point when substitute Aaron Wilbraham equalised in the 78th minute.
But Grayson's men dusted themselves down and hit their winner five minutes from time, Johnson somehow finding the net from a narrow angle.
Grayson said: "We have had a good week, seven points from nine on offer with two good away performances.
"Today you saw different sides to us, in the first 20 minutes Bristol City came out of the traps very quickly and were dominant.
"We weathered that storm, the first goal is crucial in any game and we got it.
"We grew into the game from the goal and had some really good opportunities to possibly take the game away from Bristol City.
"Unfortunately we didn't take chances, they scored their equaliser but we then showed a huge amount of character to go and get the winner which overall, I think we deserved."
Reflecting on the pattern of the game, Grayson said: "For the opening spell, we were a bit too open and didn't play from the shape of the team.
"Once we took care of he ball we knew we could break them.
"For the goal, it was a great ball in from Callum Robinson and Simon was in the right place at the right time with a great finish.
"When Bristol City equalised, we didn't let that affect us.
"We kept two up top and DJ carried us up the pitch and showed an eye for a goal
"I'm delighted for our fans who travelled down here."
Grayson had made two changes from the side which drew at Nottingham Forest, Paul Huntington replacing Bailey Wright and Aiden McGeady picked in favour of Marnick Vermijl.
Huntington for Wright in the centre of defence was done to take account of the height in Bristol City's side.