Already trailing 1-0 from the first leg in Porto Alegre, things got worse for Millonarios when Werley opened the scoring for Gremio after 13 minutes.
And they could have been forgiven for thinking it was not going to be their day when defender Roman Torres went off injured after half an hour.
But the team rallied superbly in the second half, and quickfire goals from Wason Renteria and Wilberto Cosme levelled the match early in the second half.
It was a tense finish as both sides sought a winner but it was Millonarios who got it through Renteria's late penalty.
"We have to celebrate but not too much," Renteria said. "The road is very long and we haven't won anything yet.
"Gremio were very tough opponents, they have class players, so our victory is very important."
Millonarios will now face Argentinian side Tigre in the semi-finals, while Brazil's Sao Paulo meet Universidad Catolica of Chile in the other tie.