Hameed scored 98 as Pakistan overtook India's 244 for eight with 16 deliveries to spare Friday and take a 2-1 lead in the five-match series.
Pakistan, who were themselves struggling at 173 for six in the 35th, prospered through an unbroken stand of 74 for the seventh-wicket between Abdul Razzaq and Moin Khan.
Razzaq followed his 2-44 in India's innings to remain unbeaten on 53 off 52 balls. Moin made 22 not out.
Lanky seamer Shabbir Ahmed set up the win when he removed three top batsmen, including Sachin Tendulkar, in a hostile opening burst after Pakistan elected to bowl first on a rare seaming wicket.
The win gave Pakistan the psychological edge going into the remaining two games to be played under lights at Lahore's Gaddafi stadium on Sunday and Wednesday.
Bowlers finally had something to smile about on the greenish wicket, unlike the perfect batting strips laid out for the first two matches that produced more than 300 runs in each innings.
India slipped from 37 for three to 140 for six before Yuvraj Singh cracked a defiant 65 off 76 balls late in the innings to boost the total.
Ramesh Powar (14) and tailenders Irfan Pathan (16) and Laxmipathy Balaji (21 not out) aided the recovery which saw India put on 104 valuable runs for the last three wickets.
The Indians, without four injured frontline bowlers in Anil Kumble, Harbhajan Singh, Ajit Agarkar and Ashish Nehra, were well served by young seamer Pathan who finished with 3-58.
Pathan made the early breakthroughs when he bowled opener Shahid Afridi and had Yousuf Youhana caught in the slips to reduce Pakistan to 29 for two in the seventh over.
Younis Khan was unlucky to be run out backing too far at the non-striker's end and Shoaib Malik was snapped up with the slips off Zaheer Khan.
Hameed and captain Inzamam-ul Haq added 91 for the fifth wicket to make it 156 for four by the 32nd over when India bounced back by removing both batsmen in the space of 17 runs.
Inzamam was unlucky to be given out leg-before by Pakistani umpire Nadeem Ghauri when a googly from Tendulkar hit the batsman on the front foot.
Hameed, who hit 14 delightful boundaries, mistimed a slow ball from Pathan and only managed to give a catch to Yuvraj at point.
Razzaq, lucky to survive a dropped return catch by Tendulkar, and Moin denied India any further breaks to lead their team home.
Shabbir began the match with a 14-ball first over that included six wides and two no-balls, besides the wicket of Tendulkar for zero with his third legitimate delivery.
The Indian master, fresh from a record 37th century in the previous match at at Rawalpindi on Tuesday, hung his bat out to an outswinger and was snapped up by wicketkeeper Moin Khan.
Shabbir forced the dangerous Virender Sehwag to edge a catch to Afridi at gully and then clean bowled Venkatsai Laxman with a delivery that swung in sharply.
Captain Sourav Ganguly and his deputy Rahul Dravid retrieved the situation by adding 68 for the fourth wicket to lift India to 105 for three by the 24th over.
Ganguly hit five boundaries and a six in an aggressive 39 off 41 balls, while Dravid made 33.
Pakistan won despite their bowlers sending down 23 wides and four no-balls.