Updated

Terry Dunfield played the role of the hero Wednesday night as he scored a later winner against his former club, helping Toronto FC claim a 3-2 victory over Vancouver Whitecaps FC at BMO Field.

The 30-year-old was traded from Vancouver to Toronto in July of 2011 and he turned up to bite the hand that once fed him, providing a crucial header deep into second-half stoppage time to see Toronto snap a three-game winless run.

All five goals came in the final 40 minutes of play as Vancouver took the lead in the 50th minute thanks to Darren Mattocks.

Toronto responded with two goals in the span of five minutes as Luis Silva and Torsten Frings helped the Reds take their first lead of the night.

Mattocks recorded his second goal of the night at the 90-minute mark, but Dunfield's late heroics restored the lead for the home side.

Toronto (3-11-4) improves to 13 points on the year, four points shy of the Philadelphia Union. Vancouver (8-5-6) misses out on the chance to take sole possession of third place in the Western Conference, instead remaining tied with Seattle Sounders FC on 30 points apiece.

Ryan Johnson had two glorious, and virtually identical, opportunities inside the final five minutes of the opening half.

The first came at the 40-minute mark. Johnson latched on to a through ball to go one-on-one with Joe Cannon, but the Earthquakes goalkeeper pulled off a brilliant save to deny the TFC striker.

Johnson beat Cannon on the second opportunity but was still unable to convert as his attempt struck the base of the post on its way out of play.

Toronto was left to rue those misses as Mattocks handed the visiting Whitecaps the lead five minutes into the second half.

Barry Robson played a nifty ball over the top of the TFC defense to find a streaking Mattocks. The Whitecaps striker had his initial attempt saved by Milos Kocic but was able to tuck home the second shot from a tough angle for his fifth goal of the season.

There did not appear to be a way back for Toronto, but the Reds were able to nick a goal from nothing in the 68th minute.

Ashtone Morgan collected a pass from Dunfield on the left flank and curled a low cross in front of goal. Silva slipped past his mark and poked a shot toward goal that beat Cannon at the far post.

Five minutes later, Toronto had the lead. A clearance from the Vancouver defense fell to Frings at the top of the box and the German powered a shot through traffic and into the back of the net for his second goal of the season.

The Whitecaps made for a nervy finish as Young-Pyo Lee broke free on goal five minutes from time. The South Korean went around Kocic with ease but hammered his effort off the woodwork.

Mattocks thought he had earned the visitors a point when he rose above Kocic to head home a cross from Jordan Harvey at the beginning of stoppage time, but Toronto capped the dramatic finish with a later winner as Dunfield's header off of a corner kick from Frings sealed three points for the Reds with virtually the last kick of the ball.

Both sides return to action with road matches on Saturday as Toronto takes on the New England Revolution at Gillette Stadium while Vancouver heads to Toyota Park to face the Chicago Fire.