Oliver McBurnie had given the visitors a first-half lead after he tucked home a cross from the lively Daniel James.
However, on-loan midfielder Ryan Manning netted his third and fourth penalties of the season to turn the game on its head, with Warne admitting fortune had also been on their side.
“At 1-0 you are still in it,” he said. “It could have gone three or four nil.
“I thought we were completely outplayed in the first half especially. In fairness to the fans, I appreciate that we didn’t get booed off at half-time. Sometimes you just have to hold your hands up.
“It says more about our character than it does our performance. Thanks to Lady Luck we’ve come out with a win but it sums up the character in the dressing room.
“We tried but we were just up against a very good team. It was a real football lesson. We can take the lesson and be really pleased with the three points.”
Manning was brought on at the break and proved to be the match winner as he kept his composure to twice beat Kristoffer Nordfeldt.
Referee Tony Harrington first pointed to the spot after Nordfeldt tangled with Jamie Proctor, and then again when Leroy Fer was adjudged to have blocked Will Vaulks’s wild effort with his hand.
And although Warne felt the first penalty was harsh, he insisted the second was deserved.
“I’ve got no sympathy for the second one. He’s got to be brave and take one in the face,” said the Rotherham boss.
“Ryan is doing alright on penalties. It shows how good he is on them and how confident he is. It’s fortunate he was on the pitch when we got the penalties.”
Defeat was hard to take for Swansea boss Graham Potter, who felt his side were the more deserving but bemoaned their lack of killer instinct.
He said: “Whenever it’s 1-0 you leave yourself open to anything. We weren’t as clinical as I would have liked. We restricted them to pretty much nothing but if you don’t score the second goal, anything can happen.
“Ultimately you need to score goals. They scored two but we scored one. The result is important but you also have to have a way of playing over the course of a season and that’s the thing for us. We are suffering because we put a lot into the game.
“When you look at the game in its entirety we had enough chances to get the second goal.”
Potter felt both penalties were harsh.
He added: “I haven’t seen them back. With the first one the boy’s offside to start with. There didn’t look too much to it.
“The second one I can see why the referee has given it. Leroy had to react because it was hit so hard and close to Leroy. He protected his face.
“It’s a learning point. Life’s not fair. I’ve said to the players not to feel sorry for themselves. They need to learn to put teams to bed and be clinical.”
Rotherham United: Rodak, Vyner, Ajayi, Robertson, Mattock, Towell (Proctor 75), Vaulks, Taylor (Newell 62), Williams, Vassell (Manning 46), Smith. Unused substitutes: Wood, Forde, Price, Wiles.
Swansea City: Nordfeldt, Naughton (McKay 90), van der Hoorn, Rodon, Grimes, Fulton (Baker-Richardson 90), Fer, Roberts, Celina, James, McBurnie. Unused substitutes: Olsson, Asoro, Carter-Vickers, Mulder, Dhanda.
Referee: Tony Harrington (Cleveland).