With chances flowing freely in a high-tempo first half, it might have been a different story had Lukas Jutkiewicz’s early effort crept over the line.
Derby peppered the visitors’ goalmouth throughout the contest, with Paul Green perhaps coming closest for the home side.
But as the energy levels dropped in the second half, young striker Main came off the bench to rifle home the vital goal that gave Boro a first win in nine outings and moved them to within two points of a return to the top six.
How the match remained a stalemate at the interval was a mystery as both outfits subjected their opponents to wave after wave of dangerous raids.
Jutkiewicz was a constant menace to Derby’s backline and soon tested Frank Fielding’s concentration with a powerful volley from distance.
Marvin Emnes had the ball in Fielding’s gloves before Jutkiewicz spurned the first gilt-edged opportunity of the day.
Clever footwork brought the Polish hitman beyond the Rams defence, but after bettering Fielding in a one-on-one, Jason Shackell slid in to clear the ball off the line.
Tony McMahon came close as his swerving free-kick rattled the woodwork, Barry Robson unable to head home the rebound.
Then Derby bared their teeth, Theo Robinson forcing a sprawling save from Jason Steele before Green tested the Boro stopper with a fizzing strike from distance.
Ben Davies messed up Tom Naylor’s cross before Boro stormed back into the ascendancy, Scott McDonald dragging his shot just wide and Faris Haroun stubbing off target from six yards.
The mercurial Jutkiewicz popped up to glance a well-taken Robson corner just beyond Fielding’s near post but Nigel Clough’s charges had ridden out the storm.
Indeed the midlanders would enjoy the last two sights on goal in the first half, Robinson and Green shanking wayward efforts past each post to round off a frenetic 45 minutes.
There was no let up following the break as Justin Hoyte swept up Steve Davies’ header after just 45 seconds.
The visitors were soon back on the offensive, Jutkiewicz dragging a desperate parry out of Fielding, only for Haroun to badly fluff his lines with the rebound.
Robson tried his luck from distance to a chorus of groans and suddenly the fizz went out of the game.
McDonald threatened to revive the meeting with a drive from the right flank as the final 20 minutes approached, Jeff Hendrick soon giving Steele another feel of the ball.
Robson tested Steele and Jamie Ward drew a block from Stephen McManus but both sets of players were tiring fast.
Boro boss Tony Mowbray’s response was to withdraw Jutkiewicz for teenage forward Main.
And it proved an inspired substitution as Robson lofted a defence-splitting cross over to Main, who rifled home only his second goal for the club.
With the Rams equally weary, Clough sent Nathan Tyson in place of Ben Davies in search of a similar fillip.
The former Nottingham Forest man, though, volleyed high over the bar under no pressure.
Nevertheless, the Rams continued to pour forward, Steve Davies repelled by Hoyte and Tom Carroll blasting over the bar as Boro held on for three valuable points.