Great Britain women's bid for Olympic glory was ended by Australia in an agonising 4-3 defeat after extra-time.
A last-gasp equaliser and a missed penalty cost Team GB a place in the semi-finals after Ellen White's double had give them a 2-1 lead going into the final minute of normal time.
But a defensive lapse at the death allowed Sam Kerr to haul Australia level and take the match to extra-time.
Caroline Weir then missed from the spot before goals from Mary Fowler and Kerr sent the Brits spinning out, with White completing her hat-trick in vain.
Great Britain started well and Keira Walsh crashed a shot against the post with Teagan Micah beaten but, against the run of play, Australia took the lead after 35 minutes.
Demi Stokes conceded a corner and when Arsenal's Stephanie Catley whipped the ball in Alanna Kennedy beat Leah Williamson to head in from six yards.
But White was again Team GB's hero when she levelled after 57 minutes.
The Manchester City striker latched on to Lauren Hemp's cross and glanced a fine header across Micah from eight yards.
Australia nearly regained the lead three minutes later when Steph Houghton turned the ball onto her own bar from close range.
But GB went ahead when Australia failed to clear a throw-in and White reacted quickest in the box, firing first-time into the corner despite Micah getting a touch.
Hemp almost added a third with an audacious long-range lob which had Micah scrambling, but it floated just wide.
Instead, in the 89th minute GB hesitated fatally when the ball dropped to Kerr in the area. Nobody closed down the Chelsea forward, who had all the time in the world to steady herself before firing past Ellie Roebuck from 12 yards.
In extra-time Micah did well to tip Walsh's deflected drive over the crossbar, and from the corner pushed White's close-range effort wide.
GB were gifted the chance to take the lead again nine minutes into extra-time when Nikita Parris fell under a challenge from her former Lyon team-mate Ellie Carpenter.
Weir stepped up to take the penalty but Micah saved her weak effort, diving to her left.
Moments later GB were stunned when Australia went ahead, a long-range shot from Fowler taking a deflection off Lucy Bronze and flying into the top corner.
Kerr made it 4-2 inside the first minute of the second half, rising above Houghton to head in off the underside of the crossbar.
White pulled one back with another header for her sixth goal of the Games with five minutes remaining, but they could not force an equaliser.