Britain will have two women in the final of the 1500m after Lisa Dobriskey and Laura Weightman advanced from the semi-finals, but world silver medallist Hannah England missed out.
Dobriskey, who has made a remarkable return to fitness after being diagnosed with potentially fatal blood clots on her lungs earlier this year, was fourth in the first semi-final to qualify automatically.
But Weightman endured an agonising wait as officials examined a photo finish in the second semi before going through as one of the two fastest losers in a new personal best of 4:02.99. Weightman edged out Slovakia's Lucia Klocova on the line, with both athletes given the same time.
England, who spent five days in hospital earlier this year after being spiked in her Achilles tendon during a race, was ninth in the first semi in 4:06.35.
Dobriskey said: "I've been stressed all day, I just wanted to make an Olympic final again. Last year was horrendous so I really sympathise with how Hannah's feeling at the moment because I know how it feels to be right at the bottom. I feel really sad for her."
A delighted Weightman added on BBC1: "I dipped on the line, I knew it was close. With 100m to go I saw the girl ahead of me and thought, 'I've got to catch you'.
"It's unbelievable (to be in the final). It's a dream to be at the Olympics. PB, Olympic final. What more can I say?"
England admitted the Achilles injury had cost her dearly, adding: "I didn't go on the track for five weeks, that's pretty hard to come back from and that showed today.
"It was just a gap too big in the whole of the season. I'd hoped I could make the final anyway and maybe I could have if I had run slightly better. It (the Achilles) is still sore, it's been sore every day since it happened, for the last 10 weeks.
"In the space of a minute it went from 'can I get a medal?' to 'can I even get here?'. It is great to be here, but I'm still gutted. I think I just lacked a bit of race experience and race fitness on the last lap.
"I felt better than I finished, I felt really good with a lap to go and felt I could still overtake a lot of them."