Cannot play media. Sorry, this media is not available in your territory.
Video - Mellouli's 1500m medal win
Tunisia's Oussama Mellouli won 1500m gold to stun double Olympic champion Australian Grant Hackett.
Hackett, who was going for his third successive 1500m gold in Beijing, led for much of the race before Mellouli staged a late charge with 200m to go.
Mellouli held on to win Tunisia's first ever Olympic swimming gold medal in a time of 14 minutes 40.84 seconds.
Canadian Ryan Cochrane claimed the bronze with Britain's David Davies, who won bronze in Athens, finishing sixth.
Davies had high hopes of taking a medal in the Water Cube on Sunday, but was always off the pace in a gruelling race.
The 23-year-old Commonwealth Games champion admitted the pace had been too much for him, especially after a gruelling heat on Friday.
The elephants and pianos were all on my shoulders and my heart was pounding
"I knew the 36 hours in between would be a race to recover and I did everything I could, but in the end it was really telling on me," he said.
"The elephants and pianos were all on my shoulders and my heart was pounding and my stomach was gone, and it's a long way when you're feeling like that."
He added: "It was really tough and I knew that before I came here. I would have liked to have gone quicker but I've got to recover for the 10k.
"That will be a different challenge and a tough test and I'm looking forward to it."
Mellouli, 24, returned from an 18-month doping ban in May in time to swim at the Olympics.
"I've been waiting for this moment for two years," said Mellouli.
"I had expectations for the 400m freestyle, but this is a great surprise.
"I felt good in the first 400m of this race and at the 800m and 900m I started believing that I could win.
"It was all calculated. I slowed down in the penultimate 100m to save my energy and attack in the final 50m."
After suffering defeat Hackett said he was undecided about his swimming future beyond Beijing, even hinting at retirement.
He was a competitor on the blocks, he abided by the rules, did a good race and good on him
Grant Hackett (left) on Oussama Mellouli, who recently returned from a doping ban
He said: "I'm not sure. I'm a little older now, I'll see what I feel like, have a break, then see what happens."
No man has ever won three consecutive Olympic titles in the same event, although Australian sprinter Dawn Fraser and Hungarian backstroker Krisztina Egerszegi achieved the feat in women's swimming.
"It's disappointing, yet so close," Hackett said. "To get second is great, but three in a row would have been nice.
"I have certainly no regrets in my preparation and what I've been able to do here. It was certainly a good race.
"I gave it everything today, it was a hard race. I'm a little bit tired. The heat swim was the second fastest 1500 I have ever done."
Hackett refused to be drawn into any controversy over the issue of Mellouli's doping ban.
"It's something I am not going to get into, his past is his past, it's not for me to worry about," said Hackett.
"He was a competitor on the blocks, he abided by the rules, did a good race and good on him."