Gurbaz scored his sixth ODI hundred - the joint most by an Afghanistan player - to set Afghanistan up for a tall total. He had added 150 for the opening stand with Ibrahim Zadran, who had contributed 60.
Captain Hashmatullah Shahidi (50*) also made a half-century to give his team some late impetus. Gurbaz hit eight fours and six sixes before he was bowled by Theo van Woerkom in the 39th over. Gurbaz had been particularly severe on both van Woerkom and George Dockrell, taking the left-arm spinners for 54 off 35 balls.
Rahmat Shah then then fell soon after to Craig Young, but Afghanistan managed to breach 300, for just the ninth time in ODIs.
Left-arm quick Fazalhaq Farooqi then produced a double-strike to get rid of Andy Balbirnie and Curtis Campher. Captain Paul Stirling had also departed early to leave Ireland three down in the powerplay.
Tector and wicketkeeper-batter Lorcan Tucker then steadied the innings and lifted Ireland with a 173-run partnership for the fourth wicket. While Tector hit his fifth ODI hundred, Tucker was stopped on 85 by Farooqi in the 39th over of the chase. That dismissal sparked another collapse as Ireland lost 4 for 42.
Tector then fell in the final over as Afghanistan wrapped up a 35-run victory to go 1-0 up in the three-match ODI series.