The group behind the event — Parents, Families and Friends of Lesbians and Gays — had initially said Toronto's Rob Ford had declined their invitation to the ceremony, a move they saw as a lost opportunity for the mayor.
But in a surprise showing, Ford appeared just as the ceremony got underway and took to the podium to read a proclamation against homophobia.
"Toronto is a society open to everyone," said the mayor, "including the lesbian, gay, bisexual, transsexual, two sprit and transsexual LGBT community, who are an important part of this city's diversity."
With a rainbow flag flying overhead, Ford added that Toronto was an active participant in the fight for the elimination of all forms of discrimination and was committed to equal treatment of all people.
He then received a cheer from the crowd as he hoisted a framed copy of the proclamation he had signed.
The mayor's appearance was significant as he has been accused of homophobia by some due to his decision not to attend Toronto's Pride Parade since he has taken office.
Ford has already said he will be skipping this year's parade as he will be at his family's cottage for the Canada Day holiday weekend, which is when the country's largest gay rights parade takes place.
It's the same reason he gave for missing last year's parade — a controversial move which drew much criticism.
Thursday's flag-raising ceremony was a LGBTQ outreach event which was not part of the city's Pride Week festivities.
The mayor's appearance was so unexpected that organizers had said all morning that Ford had indicated he was unavailable. Coun. Gord Perks was getting ready to read the proclamation before Ford showed up.
"I do thank the mayor for having taken the time to join us," said Irene Miller, president of PFLAG Toronto, adding that Ford and the other city councillors present had shown "tremendous support."
"We truly appreciate that you have taken the time to be here today," Miller said. "We cannot get our message out there alone, but together we can make that message heard all across this city."
A spokesman for Pride Toronto also singled out Ford's presence while addressing the crowd, and included the mayor in an expression of gratitude for anti-homophobia messages.
"Thank you all for the work you do each and every day in confronting, challenging and stopping homophobia and transphobia," said Luka Amona.
"Today we find strength in each other, we reaffirm our goal in eliminating homophobia and transphobia."
While Ford has said he will be skipping the city's Pride Parade this summer, he said he may stop by other Pride Week events depending on his schedule.
Toronto's Pride Week runs from June 22 to July 1.
Former city mayors David Miller, Mel Lastman and Barbara Hall all marched in the parade, which attracts hundred of thousands of people each year and brings millions of dollars into Toronto's economy.
Note to readers: This is a corrected story. An earlier version said Ford chose not to appear for the flag-raising.
Also on HuffPost