The Labour candidate Ray Strachan was narrowly defeated by Beth Whiteside of the SNP despite receiving more first preference votes.
Liberal Democrat Ben Lawrie, who is still a university student, said he was delighted to have been elected.
He said: “It’s absolutely thrilling. I was open and frank to the electorate and I am glad they have trusted me with their vote.
“I am in third year of university at St Andrews and I have exams on the 14th and 19th – I better get studying now!
“I am going to continue with my fourth year while being a councillor. It’s going to be a big year for me but I will give my all for the ward.”
Result
Sheila Hands SNP 1727
Ben Lawrie Liberal Democrats 794
Ray Strachan Labour 643
Beth Whiteside SNP 620
Turnout 50.8%, total votes 6,685