The stunned Swans were left cursing their luck at the New York Stadium as Rotherham snatched victory with two controversial late penalties from Ryan Manning.
The Swans dominated most of the game as Oli McBurnie fired home his seventh of the season in the 25th minute from Daniel James' cross.
But the visitors paid the price for not putting the game to bed while they were well on top and two late penalties from Manning gave a grateful Rotherham all three points.
Swans boss Graham Potter made one change from the side that beat Reading 2-0 at the Liberty Stadium with skipper Leroy Fer coming into midfield following his appearance from the bench in midweek.
He replaced Matt Grimes who moved to left-back in place of Martin Olsson who passed a fitness test to sit among the substitutes.
They faced a newly-promoted Rotherham side sitting just one place above the relegation zone with three wins from 15, although they had lost just one in seven at home.
Millers boss Paul Warne named an unchanged side from the one that drew 1-1 at Preston last week.
Both teams and sets of supporters paid an impeccable Remembrance tribute to those who lost their lives during World War 1 prior to kick-off, while also remembering those who died in the helicopter tragedy at Leicester City last week.
The Swans made a positive and lively start; enjoying the bulk of possession as Grimes fired an early free-kick from the edge of the area well over the bar as the speedy James made a bright start down the left.
James was clearly worrying the Rotherham defence as Will Vaulks crudely brought him crashing down in front of the dug-out at the expense of a yellow card. The Swans were furious and Leroy Fer joined him in the referee’s notebook for venting his feelings over the tackle.
James had the last laugh, though, as Bersant Celina sent him racing down the left again with 25 minutes gone. The winger delivered a great low cross and McBurnie arrived to fire home from close range for his seventh of the season and give the Swans a deserved lead.
The visitors, totally dominating, should have been 2-0 up in the 36th minutes as the impressive Celina beat the offside trap to latch on to a long pass from Mike van der Hoorn. But goalkeeper Marek Rodak was out to block his effort.
The Swans started the second half where they left the first as Connor Roberts pulled back a great cross to the edge of the area where Fer looked odds on to double their lead. But his shot was saved superbly by Rodak with 48 minutes on the clock.
Rotherham were slowly starting to make life a bit tougher for the Swans going forward before Jay Fulton fired over.
Potter’s young side still looked comfortable in possession, but were given a timely warning in the 69th minute that they needed a second when substitute Ryan Manning forced great save from Kristoffer Nordfeldt.
Celina tried to put the game to bed with 15 minutes to go after another positive run from James, but his shot was saved by Rodak.
And the inevitable happened in the 79th minute as Rotherham snatched the equaliser from the penalty spot after Nordfeldt was adjudged to have fouled substitute Jamie Proctor as he went to punch the ball clear. Manning duly stepped up to hammer the ball beyond the stunned Swansea ‘keeper.
It got worse for the Swans as Rotherham were gifted another penalty after Fer was adjudged to have handled a fierce shot from the edge of the area and Manning slotted home his second with just four minutes remaining.
Rotherham: Marek Rodak, Zak Vyner, Joe Mattock, Will Vaulks (capt), Semi Ajayi, Jon Taylor (Joe Newell, 62), Richie Towell (Jamie Proctor, 75) Clark Robertson, Kyle Vassell (Ryan Manning, 45), Ryan Williams, Michael Smith.
Subs: Lewis Price, Richard Wood, Anthony Forde, Ben Wiles.
Swans: Kristoffer Nordfeldt, Kyle Naughton (Barrie McKay, 90), Joe Rodon, Mike van der Hoorn, Matt Grimes, Jay Fulton (Courtney Baker-Richardson, 90), Leroy Fer (capt), Bersant Celina, Connor Roberts, Daniel James, Oli McBurnie.
Subs: Erwin Mulder, Joel Asoro, Yan Dhanda, Martin Olsson, Cameron Carter-Vickers.
Ref: Tony Harrington