Cristiano Ronaldo appeared to have given the visitors three points, but a Ramos own goal and a stunner from the new signing changed everything
Real Madrid's 40-match unbeaten run came to an end as Sevilla scored twice late on to secure a 2-1 victory in a thrilling conclusion to Sunday's La Liga encounter.
It was the teams' second meeting in four days at the Ramon Sanchez Pizjuan after an enthralling 3-3 draw in the Copa del Rey last 16 on Thursday, but until the 85th minute this clash failed to live up to the drama of that tie.
Cristiano Ronaldo had given Madrid the lead midway through the second period with a coolly taken penalty - his 21st goal in just 13 appearances against Sevilla.
The build-up to this fixture saw the clubs involved in a spat surrounding Sevilla fans' treatment of Sergio Ramos during the Copa clash, and the home fans will have taken delight in the Madrid captain heading past his own goalkeeper to level matters.
But worse was to come for the leaders as, in stoppage time, Stevan Jovetic marked his maiden league appearance for Sevilla with the winner - curling a shot from just outside the box that Keylor Navas could only parry into the bottom-right corner.
The victory - Sevilla's eighth at home from nine league outings this season - lifts them above Barcelona and into second, a point behind Madrid who have a game in hand.
Ramos - chosen alongside Nacho and Raphael Varane in a back three rather than the usual four - was rarely troubled as Sevilla struggled to break through until the remarkable end to the game.
Steven N'Zonzi glanced a header over from a corner and Samir Nasri brought a comfortable save out of Navas, while at the other end Ronaldo thumped one free-kick into the wall and saw another low shot easily held by Sergio Rico.
The best chance of the half arrived five minutes before the interval, but Ronaldo failed to get a telling touch on Karim Benzema's low ball across the area.
Sevilla began the second period brightly with Navas forced to tip over Franco Vazquez's effort and the goalkeeper got down smartly to his right to deny Wissam Ben Yedder's low drive in the 54th minute.
Benzema wasted a glorious chance nine minutes later, hacking wildly over from eight yards following a mad scramble inside the Sevilla box.
But Madrid were not made to rue that miss as Dani Carvajal robbed Sergio Escudero and burst into the area, where he was taken out by Rico close to the byline.
Sevilla complained about the decision, without justification, and after Vitolo attempted to put off Ronaldo by scuffing the penalty spot - Ronaldo throwing the ball at his opponent in retaliation - the Portuguese calmly dispatched his kick into the bottom-left corner.
It was Ronaldo's 12th goal in seven trips to Sevilla, but the hosts were not in the mood to give up and had their leveller five minutes from normal time as Pablo Sarabia's wicked free-kick from the right was nodded in by Ramos.
And there was to be one final twist as Navas failed to keep out Jovetic's effort, Sevilla fans and players ecstatic at the final whistle as a shell-shocked Madrid were forced to contemplate their long undefeated run coming to a close.