Selangor, whose last Cup victory came in 2005, fell behind to a Shahrom Abdul Kalam strike in the 37th minute, but hit back in the second half with goals from Razman Roslan and Amri Yahyah to seal their spot in the last eight.
T-Team, who had already booked their place in the quarter-finals last weekend, made sure they finished top of Group D with a 6-0 thumping of PDRM. First-half goals from Indra Putra and Zairo Anuar Zailani gave the Terengganu-based outfit a steady half-time lead, before further strikes from Norfarhan Mohammed, Badrul Hasani, Norfazly Alias and Shamsul Kamal completed the rout.
Sabah also advanced to the quarter-finals with a commanding 4-1 victory over basement club Johor FA, while Group A's other fixture saw Kedah and Perak play out a 1-1 draw.
Terengganu and Negeri Sembilan, who were both already assured of their quarter-final berths, played out a dour 0-0 draw, while Sime Darby FC fell to a 1-0 home loss at the hands of PKNS in Group B's dead rubber, courtesy of Fauzan Dzulkifli's 75th-minute winner.
Finally in Group C, Kelantan made sure of top spot with a 2-0 win over group runners-up KL Felda United, while Johor FC ended their campaign with a 3-1 win over Sarawak.
Malaysia Cup Group Stage Results
Kedah 1-1 Perak
Sabah 4-1 Johor FA
Terengganu 0-0 Negeri Sembilan
Sime Darby FC 0-1 PKNS
Kelantan 2-0 KL Felda United
Johor FC 3-1 Sarawak
Selangor 2-1 Kuala Lumpur
PDRM FC 0-6 T-Team
Malaysia Cup Quarter-final Draw
Selangor vs Perak
KL Felda United vs Negeri Sembilan
Terengganu vs Kelantan
Sabah vs T-Team