The 24-year-old was an unused sub for Jack Wilshere's side, who came from behind to win the competition for the second time in their history - they first won it in 2009.
Luton won the tournament having lost to Swindon Town in the last 16 before being reinstated because the Robins fielded two ineligible players - including former Town forward Aaron Drinan.
It was Stockport who took the lead in the 11th minute when Adama Sidibeh ran 40 yards before finishing past Hatters goalkeeper James Shea.
However, Luton drew level through Emilio Lawrence, before Nakki Wells scored twice to seal the victory for the Bedfordshire outfit.
Al-Hamadi, who is spending the season on loan at Kenilworth Road, netted his first goal for the Hatters on Easter Monday as they won 3-0 at his former side AFC Wimbledon.
The Iraqi international will now look to help his loan club push for the third tier play-offs as they currently sit 10th in the table, six points from the final play-off spots with five games remaining.
He is set to play at the World Cup finals with his country this summer after helping the Iraqis reach their first World Cup since 1986 last month.