Congress nominee K Venkatesh defeated K Mahadev of the Janata Dal-Secular by over 2,000 votes in the May 28 poll whose votes were counted today.
Periyapatna, about 200 km from Bangalore, did not vote with the rest of the state May 5 following the death of the Bharatiya Janata Party candidate.
Venkatesh polled 62,045 votes while Mahadev bagged 59,957, election officials told reporters here.
The third place was taken by HD Ganesh of BSR Congress, a regional outfit formed by former Bharatiya Janata Party (BJP) minister B Sriramulu. He got over 5,000 votes.
The BJP, which was routed in the May 5 poll, fared miserably in Periyapatna as well with its candidate R.T. Satish coming fourth, getting only 3,731 votes and losing his security deposit.
More than 80 percent of Periyapatna's over 160,000 eligible voters had voted May 28.
With the Periyapatna victory, the Congress has taken eight of the 11 assembly seats from Mysore district.
It also boosted Chief Minister Siddaramaiah as Periyapatna falls in his home district Mysore.
The Congress victory has dashed the JD-S' hopes of becoming the second largest party in the assembly. It is now tied at the second spot with BJP as the two have won 40 seats each.
The remaining 22 seats are shared by smaller parties and individuals. One member is nominated to represent the Anglo-Indian community.