Davydenko hit 35 winners to 15 for Ginepri, but committed 53 unforced errors over the final two sets.
The Russian started well against Ginepri by converting one of three break chances to win the first set.
The players traded breaks to make it 4-4 in the second set before Davydenko failed on three break opportunities in the next game. Ginepri had triple set point in the 10th game, converted when the Russian netted.
Both players held serve until the 10th game of the deciding set, Davydenko hitting wide to give the 63rd-ranked American a double match point that was converted when the Russian double-faulted.
Australian Open finalist Jo-Wilfried Tsonga advanced after rallying to beat Spanish qualifier Marcel Granollers 3-6, 6-3, 7-6 (5).
Tsonga will next face either second-ranked Roger Federer or Radek Stepanek, who play later Wednesday.
The 58th-ranked Granollers decisively broke the Frenchman's serve in the sixth game as he hit 14 winners to take the first set.
Tsonga, ranked No. 15, won the second set thanks to his booming forehand and court speed.
Granollers led 5-3 in the third set before Tsonga broke back and held serve to force the tiebreaker.
The third-ranked Novak Djokovic opens against Victor Hanescu of Romania.
Andy Murray into Madrid Masters 3rd round
Salgado: Robinho Can Do More
Djokovic into Masters 3rd round; Davydenko out