With 68 points separating the top two going into the final 800 metres event, Theisen Eaton needed to finish 4.69 seconds ahead of Melnichenko but the Ukrainian shadowed her rival round the two laps to take gold.
The 30-year-old collapsed on the track after crossing the line and held her head in disbelief as the final result flashed up, bringing the hundreds of Ukrainians in the crowd, easily recognisable in bright blue and yellow T-shirts, to their feet.
Melnichenko finished the seven events with a personal best total of 6,586 points, 56 more than Theisen Eaton, who also scored a PB and was given a congratulatory hug at the finish by her husband and world decathlon champion Eaton.
The pair, who married last month, are the first husband and wife to win medals in a global combined-event competition.
"I watched Ashton the last couple of years winning all his medals and could only sit back and imagine what that felt like," the 24-year-old said.
"After the 800-metres he just said to me 'good job and enjoy your victory lap'. "We'll probably just go home now, sit on the couch for a few days watching television and eating crappy food."
World junior champion Dafne Schippers of the Netherlands charged down the home straight to finish third and secure the bronze medal with a national record of 6,477, an effort that left her needing to be helped off the track by officials.
Leader overnight, Melnichenko produced season's bests in the long jump (6.49 metres) and the javelin (41.87) to give her the advantage going into the 800, the event all heptathletes loathe.
Melnichenko's best in the two-lap race was three seconds slower than Theisen Eaton, so she kept the Canadian close throughout, finishing just over half a second behind her.
"I realised that I could win after the javelin throw," Melnichenko told reporters.
"The time between the javelin and the 800 metres was the most exhausting time ever," she added.
Olympic champion Jessica Ennis-Hill of Britain and Russia's 2011 world champion Tatyana Chernova missed the event due to injury.
Source: The Star Online