Fabio’s stunning goal early on gave the visitors the lead, before Ramírez’s goalbound header was turned into his own net by defender Matthew Connolly to send the sides in level at the break.
The Uruguayan then grabbed his first for the club just after the hour mark as he calmly volleyed home from just inside the penalty area.
A foul on Ramírez in the box gave Grant Leadbitter the chance to make it three for the hosts, but the midfielder saw his penalty saved by David Marshall.
The third did eventually arrive in the 83rd minute as a Ramírez-inspired counter saw Albert Adomah tee up David Nugent to seal the win for Karanka’s side.
Elsewhere on Tuesday night, Lloyd Isgrove played the full game as Barnsley drew 0-0 away to Bury in League 1.
The winger was unable to help his side to victory, despite going close to opening the scoring in a tight encounter at Gigg Lane.
The Tykes had to hold on late in the game following Adam Hammill’s red card, with the point enough to keep them tenth in the table heading into the final 14 games of the season.
On Monday night, Sam McQueen came off the bench to help Southend United stun table-topping Burton Albion.
Anthony Wordsworth opened the scoring early on for the Shrimpers, but Stuart Beavon’s equaliser just before half time drew the visitors level.
A terrific strike from Tyrone Barnett saw Phil Brown’s men regain the lead midway through the second half, before McQueen set up David Mooney to round off the scoring in injury time after coming off the bench.