Swindon boss Michael Flynn said his side showed the best and the worst of themselves as they almost threw away a 4-0 lead at Accrington.
The Robins were four goals ahead but three added-time efforts from Stanley left Swindon holding on for a 4-3 win.
Swindon took the lead in the 17th minute through Dan Kemp’s penalty and League Two’s top scorer Jake Young fired home his seventh goal in six games after 31 minutes.
Stanley manager John Coleman was sent off at half-time.
A spectacular 25-yard goal from Saidou Khan made it 3-0 on the hour mark before Swindon keeper Murphy Mahoney saved a Tommy Leigh penalty.
Substitute Charlie Austin made it 4-0 in the 89th minute before Korede Adedoyin started the comeback by drilling the ball home in the second minute of added time.
Defender Brad Hills pushed up front and hit a brace deep into 10 minutes stoppage time with Swindon clearing a late Adedoyin effort off the line to ensure the win.
“It was a brilliant performance for 90 minutes and then was the worst of us for the next 10 minutes,” said Flynn.
“It was very poor and we did our best to throw away the three points. We tried to look after a couple of players on a freezing cold night and made changes and we should have seen the game out, we should never have been in the position we were in.
“It was a perfect away performance for 90 minutes but the ultimate feeling at the moment is frustration as the way we have finished, that’s taken the shine off it.
“Saying that it’s seven points from three games, with two away games in that, and you have got to be pleased.
“I would have taken 4-3 before kick-off. Credit to them though, they gave us a scare.”
With Coleman sent off, assistant Jimmy Bell faced the media.
He said: “It was a never-say-die performance and we should have got something out of the game at the end.
“We have had large majority of attempts at goal, more possession, more shots on target, more corners and somehow we ended up 4-0 down. It was a crazy game.
“But after that the players showed a resilience to try and get something out of the game, their heads never went down.
“We know there are a lot of things we have to sort out defensively. I am disappointed we got beat at home and conceded four goals but what we showed at the end is something to build on.”
On Coleman’s dismissal, he said: “John was annoyed at a couple of decisions by the referee and he wasn’t allowed to come back on.”