Chasing India's challenging 291-4, Australia made 283-7 to allow India to pull one back in the seven-match series and reduce the margin to 2-1. The first game was abandoned due to rain.
Australia appeared to be cruising towards a win after Matthew Hayden top-scored with 92 and Andrew Symonds hit 75 but the game turned on its head through some spirited bowling by the Indians at the death.
It was India's first win over Australia in 11 matches, the last coming in Brisbane in January 2004.
Left-arm seamer Rudra Pratap Singh (2-66) changed the complexion of the match in the 47th over when he clean-bowled Symonds and then ran out Brad Hogg on the next ball.
Needing 16 off Zaheer Khan's last over, James Hopes (23 not out) hit a four off the first ball but could manage only three more runs off it in the company of Brett Lee.
Man of the match Dhoni made two brilliant stumpings after making a 35-ball 50 which helped India finish strongly despite a sedate start.
Scorecard | Photo gallery
"We were not able to chase earlier on in the series so we decided to bat first. Credit should go to Tendulkar and Ganguly for giving us a good start. Our bowlers also bowled very well in the middle overs," Dhoni said.
"We needed to be aggressive otherwise we could not have come back in the series like this."
Sachin Tendulkar anchored the innings with 79 off 119 balls while adding crucial 91 runs with Sourav Ganguly (41) and 83 with Yuvraj Singh (39).
"The Indians played very well, they kept wickets in hand and opened up only at the end," Australian skipper Ricky Ponting said.
"We were in a comfortable position while chasing but then lost crucial wickets."
Australia started their innings in a blazing fashion, despite losing Adam Gilchrist (18) early once again, thanks to some lusty hittings by Hayden.
Hayden, who slammed 11 fours and two sixes in his run-a-ball knock, holed out to Zaheer off left-arm spinner Murali Kartik (1-48) after he had hit the same bowler for a four a ball earlier.
Symonds took Australia close to the target with his 84-ball 75 before being clean-bowled by a searing Rudra Pratap delivery.
The match was marred by some debatable umpiring decisions, one of which involved Ponting.
The Indians appealed for a stumping after Ponting missed a drive against Irfan Pathan. With the TV umpire taking some time to reach the decision, Ponting got ready to take strike, confident that he was not out.
But Ponting had to walk off once the giant screens beamed the umpire's verdict, the skipper glaring and muttering all the way back to the pavilion.
Tendulkar also appeared to have nicked Lee earlier in the day but umpire Suresh Shastri turned down the appeal.
The Australians paid the price for being unusually wayward in the field, giving away 39 extras including 31 wides, which was one less than their worst ever show against Sri Lanka in 2002-03.
The next match would be played in Baroda on Thursday.