Ping called for international assistance to protect the population of the oil-producing state and said Saturday's election was stolen by Bongo, who was declared the winner on Wednesday.
The result gives the president a further seven years in power in the country of 1.8 million people. Bongo took power in 2009 on the death of his father, who had ruled for 42 years.
"Everybody knows that I won the election," Ping told Reuters, adding that the electoral commission's figures were based on false documents.
"The (Bongo) family are repeating the same scenario for almost half a century. The opposition can win the elections but they have never had access to power... We need assistance from the rest of the world to protect the population of Gabon from a clan of mercenaries, a rogue state," he said.
Opposition supporters greeted the election result with anger. Demonstrators in the capital Libreville clashed with police and set part of the parliament building on fire. It burned for hours before being extinguished, witnesses said.
On Thursday there were fresh clashes in the impoverished Nkembo neighborhood near the center of the capital. Gunfire and explosions could be heard, witnesses said. A government spokesman was not immediately available for comment.
French Foreign Minister Jean-Marc Ayrault called for an immediate end to violence. France is Gabon's former colonial power and retains strong economic and cultural links.
"Within the framework of a political process, there's no room for violence," Ayrault said in a statement. "I'm calling, therefore, all parties to exercise the utmost restraint to avoid additional victims."
NO CLEAR PATH
France, the United States and the European Union urged calm and called on authorities to release the results of individual polling stations for greater transparency, while the United Nations also urged restraint.
Bongo won 49.80 percent of votes against 48.23 percent for Ping, on a turnout of 59.46 percent, according to results given region by region by Interior Minister Pacome Moubelet Boubeya.
"This victory by such a tight score obliges ... each of us to respect the verdict of the ballot box and our institutions," Bongo said in the text of a speech distributed to reporters.
Ping, a political insider who has served as foreign minister and African Union Commission chairman, was a close ally of the late president and fathered two children with his daughter.
His avenue for contesting the result appeared uncertain. Elections in Africa are frequently disputed but it is unusual for results to be overturned.
Ping said he was not calling on his supporters to protest because they were already under so much pressure from authorities. He said he feared arms would be planted in his party headquarters and he could be arrested as a result.
Voting was peaceful but the election followed a bitter campaign in which both sides traded accusations of fraud. Opposition suspicions were heightened when the release of results was delayed earlier in the week.
An EU observer mission criticized a "lack of transparency" among institutions running the election and said Bongo had benefited from preferential access to money and the media.
France's Foreign Ministry also said the way in which the results were announced was a source of concern.
"We think it is necessary to publish the results of all the polling stations. The credibility of the election as well as Gabon's international reputation are at stake," it said.