Shaffelburg entered the game as a substitute in the 69th minute, and the former Toronto FC Academy product found the scoresheet five minutes later. Patrick Mullins sent a nicely placed pass into open space in the NYCFC box, and Shaffelburg converted for the equalizer.
Jesus Medina scored to give New York City (2-1-2, 8 points) the lead in the 53rd minute.
Toronto FC (1-2-2, 5 points) may have capitalized on a lack of composure from NYCFC, as Shaffelburg's goal came just moments after a pair of controversial incidents.
Toronto goalkeeper Alex Bono sent a clearance kick off the head of a jumping Medina and the ball deflected back into Toronto's net, except the referee's whistle had already blown.
Shortly after that play, NYCFC's players argued vociferously about a non-call on what they felt was a bookable offense from Toronto's Dom Dwyer.
A misplay by Bono set up the game's opening goal. A hard free kick from Gudmundur Thorarinsson took a short hop just in front of Bono that seemed to confuse the Toronto keeper. Bono blocked the shot but couldn't gather the ball, and Medina was there to convert the rebound.
Medina is off to a hot start with four goals in five games. The midfielder is already closing in on his previous season high with NYCFC -- six goals in 28 games during the 2018 campaign.
Valentin Castellanos also seemed to hurt his left wrist after a fall in the 40th minute, but the star NYCFC striker remained in the game.
Toronto FC is 3-1-2 in their last six regular-season games against New York City.
Dwyer played 21 minutes off the substitute bench in his debut with Toronto. The forward signed with the team earlier this week.