The appeals court in the central city of Kairouan ruled that the case against activist "Daniel" was null and void, rights group DAMJ said.
"It's a victory for Daniel and a victory for us," the group told AFP.
Court spokesman Riadh Ben Halima confirmed the ruling, saying it was on the basis of "procedural irregularities, as police had searched his computer without a warrant".
Daniel, along with five other men, had originally been charged in 2015 with "homosexual acts", which is punishable by up to three years in prison in the North African nation.
Later that year, they were each sentenced to the full three years in prison, and banned from living in Kairouan province for a further three years.
They appealed the verdict, and in 2016 had their sentences reduced to 40 days in prison.
But in 2018 Tunisia's Court of Cassation, the country's top court, sent the case back for another appeal on technical grounds.
By that time, five of the men had fled abroad and found asylum, but Daniel remained in Tunisia and was hauled back to court in December.
Around 30 protestors had gathered outside the court in Kairouan, considered one country's more conservative cities.
Article 230 of Tunisia's penal code punishes consensual homosexual acts with up to three years in prison and allows the state to conduct anal tests on suspects, a practice harshly criticized by the United Nations Committee Against Torture.
Article 230 dates back to the French colonial era, but has remained in force since Tunisia's independence in 1956.
Ben Halima confirmed that the prosecution had requested to throw out the results of anal tests in the case, a move DAMJ called a "first."
Since Tunisia's 2011 revolution, LGBTQ activists have been able to work more publicly, but their situation remains precarious due to both legal and social norms.