Australians Ebden and Peers win tennis men's doubles in Paris
After dropping their first set of the week, the two 36-year-olds also trailed 4-2 in the second set but recovered the momentum to set up a super tiebreak.
The Australians moved 9-5 ahead but were pegged back to 9-8 before Peers produced an ice-cool volley after his serve and then pounded away a smash to seal victory.
It is only Australia's second Olympic tennis gold after Todd Woodbridge and Mark Woodforde won in Atlanta in 1996.
Peers added gold to the bronze he claimed in the mixed doubles alongside Ash Barty at the Tokyo Games.
The Americans, with 40-year-old Ram, one of three former doubles world number ones on court, showed his quality.
But he dropped serve at 4-3 in the second set and that proved a turning point in the match as the Australians raced through the second-set tiebreak to set up a decider.
A remarkable pick-up by Peers saw the Australian almost end up in the front row of Court Phillipe Chatrier and Krajicek then sent a smash wide to make it 7-2 in the first-to-10 decider.
The US pair saved three match points to leave Peers with a serve for gold. With his daughter crossing her fingers in stands, he finished the job to start the Australian party.
The bronze medal match will be between Americans Taylor Fritz and Tommy Paul and Czech duo Tomas Machac and Adam Pavlasek later at Roland Garros.