Contesting as an Independent candidate, Dhinakaran got 89,013 votes as against Madhusudhanan's 48,306 votes. The DMKs' N.Marudhu Ganesh came a poor third securing 24,681 votes.
Supporters of Dhinakaran celebrated the victory by dancing, distributing sweets and bursting crackers.
From the start, Dhinakaran was in the lead and the gap between him and the rivals kept on widening as the counting progressed.
Earlier in the day, Dhinakaran, speaking to reporters at the Madurai airport, predicted that the government headed by Chief Minister K. Palaniswami will fall in three months time.
He said the people in R.K. Nagar have reflected the views of the Tamil Nadu's populace.
While 2,373 voters have voted for 'none of the above' (NOTA) option, BJP candidate K.Nagarajan has got 1,417 votes and Naam Tamizhar party's Kalaikotudhayam got 3,860 votes.
The by-poll was held on December 21 and around 1.77 lakh voters exercised their democratic right.
Ironically the defeat of AIADMK's 'Two Leaves' symbol by Dinakaran's "Pressure Cooker" came on the 30th death anniversary of party founder and late Chief Minister M.G. Ramachandran.
Speaking to reporters here after his victory, Dhinakaran said though he was an Independent candidate, AIADMK's party cadres were with him.
Barring Dhinakaran and Madhusudhanan, the remaining 57 candidates forfeited their poll deposit failing to secure one-sixth of the total votes polled.
Dhinakaran is also the first Independent legislator since 2001 win of M.Appavu from Radhapuram constituency.
The by-poll is considered an acid test for the ruling AIADMK, as it underwent a split and then a patch-up, with Deputy Chief Minister O. Panneerselvam going out of the party and then rejoining it.
In the meantime, Dhinakaran, who was the party's Deputy General Secretary, and his jailed aunt V.K.Sasikala were sidelined forcing the former to contest as an Independent.
Meanwhile, leaders of several parties have termed Dhinakaran's victory as the victory of cash play.
DMK leader M.K. Stalin, in a statement, said the party's defeat in the by-poll is actually a Himalayan defeat for the Election Commission, claiming it or police did not do anything to ensure that the poll was held in a free and fair manner.
He said the Election Commission remained silent when voters were bribed even when the polling was under progress.