The 23rd-seeded Lopez was leading 6-3, 4-0 on Sunday when Stakhovsky retired. Lopez reached the fourth round at a Grand Slam for the first time since 2008 Wimbledon.
Stakhovsky said the toe started bothering him during his doubles match Saturday. It got worse overnight to the point he had trouble even walking Sunday.
Both players went to five sets in the second round. Ukraine's Stakhovsky, ranked 36th, saved three match points in the fifth-set tiebreaker against American teenager Ryan Harrison.