In 2254, Nancy became romantically involved with Dr. McCoy; she even had a nickname for him, "Plum". Their relationship broke off in 2256, but McCoy's feelings for Nancy remained unchanged for almost a decade.
In 2266, Captain Kirk led a landing party to the surface of M-113 to perform the routine medical examinations required of all scientific expeditions. On the planet, the landing party encountered who they thought was Nancy Crater. What the landing party saw was actually the M-113 creature impersonating Nancy Crater. Each member of the landing party saw a different woman, although they weren't aware of that.
The first image McCoy saw was Nancy as he remembered her, like a girl of twenty-five. The first image Kirk saw was Nancy as he expected her to be, an older woman with gray in her hair. The closest the landing party came to realizing they were seeing different women was when Crewman Darnell remarked that Nancy reminded him of a woman he'd met on Wrigley's pleasure planet – a comment that drew a sharp rebuke from McCoy. Later, McCoy saw the same woman Kirk saw; he chalked his earlier view up to affectionate memory and dismissed it.
There was some evidence that McCoy's strong love for Nancy Crater affected the creature. On several occasions, it could have easily killed him, and did not. Additionally, as Nancy, it sought him out for protection when its nature had been at least partially discovered, and it was being hunted. (TOS: "The Man Trap")