Boxer Kevin Lerena's evidence relates to firearms charges against Pistorius and raises questions about the character of a man who insists he accidentally shot dead Reeva Steenkamp in his home in the early hours of February 14 last year.
Prosecutors allege he intentionally shot Ms Steenkamp, his 29-year-old girlfriend.
Mr Lerena said the restaurant shooting happened when he and Pistorius and two other friends were in a restaurant in the upmarket Melrose Arch area of Johannesburg in January 2013.
One friend, Darren Fresco, passed his gun to Pistorius under the table and told him that there was a bullet in the chamber, Mr Lerena said. Then a shot went off, puncturing the floor near Mr Lerena's foot had been.
"There was just complete silence," said Mr Lerena, who described being in shock and having blood where his toe was grazed. Then, he said, Pistorius apologised, saying: "Are you okay? Is everybody okay?"
Before the restaurant management approached the table, Mr Lerena said, Pistorius asked Mr Fresco to say he was responsible for the gunshot.
"Just say it was you. I don't want any tension around me," Mr Lerena remembered Pistorius saying. "There's too much media hype around me."
Mr Lerena said they paid the bill and left the restaurant and he never spoke about the incident. Two days after Pistorius shot Ms Steenkamp, he said he woke up to find more than 100 missed calls on his telephone as media from around the world tried to contact him to ask about the restaurant shooting.
Earlier, chief defence lawyer Barry Roux sought to undermine the prosecution testimony of a couple who say they heard a woman's screams and gunfire the night that Pistorius killed Ms Steenkamp.
Mr Roux claimed telephone records would show the banging sounds neighbours heard were not gunshots but a distressed Pistorius breaking down the toilet door with a cricket bat after realising he had shot Ms Steenkamp when she was in the toilet, thinking it was an intruder,
Throwing doubt on the witnesses' recollection of the sequence is crucial for Pistorius's defence after the state maintained there was a loud argument on the night he shot Ms Steenkamp through a door in his bathroom and screams and shouts before a gun was fired.
Pistorius's team wants to show the screams were Pistorius calling for help after the accidental killing.
Charl Johnson and his wife Michelle Burger have testified to hearing a woman screaming, a man shouting for help and then gunshots.
During his cross-examination of Mr Johnson, Mr Roux said phone records will show Pistorius called an estate manager at around 3.19am and soon after he bashed in the door with the bat.
In Mr Johnson and Ms Burger's evidence, they said they heard what they described as shots straight after making a call to security at 3.16am. The similar times show the sounds were the bat on the door, Mr Roux argued.
Pistorius denies murder and three other counts relating to shooting guns in public and illegal possession of ammunition.
The trial continues.