Dozens of partygoers were stranded overnight on a tiny uninhabited island after being cut off by the rising tide.
About 500 people walked across the causeway to Cramond Island in the Firth of Forth on Saturday after the party was advertised on Bebo and Facebook.
But by late evening up to 200 of them were cut off from the mainland when the tide came in and covered the causeway.
A rescue operation was mounted by Forth Coastguard and the Kinghorn and Queensferry lifeboats.
Police and ambulance crews were also called to the scene.
Some of the revellers were taken off the island by boat late on Saturday night, while about 70 managed to walk to the mainland when the tide went out again between 0130 BST and 0530 BST.
The remainder were picked up by boat when the island was again cut off from the mainland by the tide at 0530 BST.
Forth Coastguard said it had received 999 calls after many of the people who went over for the party forgot that the tide was coming in.
Several of those who were rescued had just been wearing T-shirts.
Coastguard watch manager Angus MacIver said: "We understood there had been a large gathering of young people on the island.
"The difficulties arose when the weather conditions deteriorated from a hot sunny day to a cold night with northerly winds and rain. We were then concerned for their well being and the risk of exposure to the weather.
"Working with the police to ensure public safety, we assisted many of the young people to safety by escorting them across the causeway in the night, which had to be illuminated.
"In addition a further 50 were taken by Kinghorn and Queensferry RNLI lifeboats to safety."
Some people suffered minor injuries from trips and bumps, but there were no serious injuries.
The Bebo page of 24-year-old Stephen Zaccardelli, a DJ who helped organise the event, featured a warning to anyone planning on attending the party that they would need to leave the island by 2000 BST on Saturday if they did not want to spend the night there.
Mr Zaccardelli also wrote that there would be lighting and trained first aiders on Cramond, and encouraged revellers to use the provided bin bags to tidy up after themselves.
Cramond island is about a mile from the mainland and lies off the village of Cramond near Edinburgh.