Mr Ping said two people had been killed as live shots were fired.
His supporters had been staging protests after official results gave President Ali Bongo a narrow victory in Saturday’s presidential election.
They accused the government of stealing the election.
The election result, announced on Wednesday afternoon, gave Mr Bongo a second seven-year term with 49.8 per cent of the vote to Mr Ping’s 48.2 per cent – a margin of 5,594 votes.
But Mr Ping disputes the result in one province which shows a 99.93 per cent turnout with 95 per cent voting for Ali Bongo.
EU election monitor spokesperson Sarah Crozier told BBC Newsday “it’s not a very common result, that’s for sure”.
Mr Ping said the election was fraudulent and “everybody knows” he won.
He also denounced the raid which happened while he was not in the building.
“They attacked around 01:00 (00:00 GMT). It is the republican guard,” he said. “They were bombarding with helicopters and then they attacked on the ground.”
Mr Ping has called for international assistance to protect the population and has called for voting figures from each polling station to be made public.
The US and EU have also called for the results to be made public while UN Secretary-General Ban Ki-moon has urged calm.
Mr Bongo took office in 2009 after an election marred by violence, succeeding his father Omar Bongo who had come to power in 1967.
Mr Ping had been a close ally of Omar Bongo, serving him in ministerial roles and having two children with his daughter, Pascaline, a former Gabonese foreign minister herself. -BBC