Chris Martin fired the Rams ahead just before the break, five minutes after Main's dismissal for Boro, but McClaren's side then struggled to create many clear-cut chances and were made to pay when Dean Whitehead steered in his first goal for the Teessiders to make it 1-1 after 73 minutes.
And just as it seemed Boro would hang on to a point, up popped Derby substitute Connor Sammon to scramble in a last-minute winner, for only his second goal in 13 games.
"It's three points," said a sheepish McClaren. "That's it. It was not a good performance by our normal standards.
"We talk about getting a performance and the result will follow. The Championship is tough and there are different ways you have to win. We won it despite not playing our usual brand of football and we were disappointing in that."
While most onlookers would suggest that Derby were fortunate winners, the former England coach refuted those suggestions.
"I wouldn't say we were lucky as we kept our patience," added McClaren. "If we were going to achieve anything or deserve to be in the position we're in, then we have to score in the last 10 minutes.
"We waited for the moment and took it. They're the kinds of things teams have if they're going to be successful."
While Middlesbrough head coach Aitor Karanka was left deflated after Sammon's late intervention, he was pleased with his side's application on the night.
"You can't be sad when you lose one game," said the ex-Real Madrid assistant boss.
"To concede goals at the end of both halves, we felt bad. I saw I have a team which is together, everyone was helping each other and fighting the same battle and I was very happy about that.
"It was very encouraging. When you lose the way we did, you cannot really say anything to the players."
Karanka was left baffled by Main's red card, which came after his lunge on Derby defender Jake Buxton and saw him booked for the second time inside 10 first-half minutes.
"I would like to know why he was sent off," went on Karanka. "If he deserved two yellow cards, then you would be ending every game with six or seven players."
He dropped Mustapha Carayol to the bench, but brought him at half-time and was rewarded when the winger's trickery set up Boro's equaliser and he was delighted with his display.
"The fastest player I had on the bench was Muzzy and I was thinking of keeping (Kei) Kamara and (Albert) Adomah on the wings, and so play him up front with his pace," added the 40-year-old Spaniard. "He played very well and I was very happy with his work."