A terrorist group could still be democratically elected. Terrorism just means that they employ a policy to intimidate and scare others by use of acts that will scare and terrorize the population. It is possible to have a terrorist group that was still electing people. Hamas has shown to have terrorist ties.
Overall Hamas is a very controversial organization that people have vastly different opinions about, I think that Hamas does commit acts that lead to death of innocent people and so in my eyes they are considered a terrorist organization regardless if they are democratically elected or not I don't think it matters.
Hamas is still a terrorist organization, and will be until they declare that Israel is a state and exists and can co-exist peacefully. I think that Hamas is getting closer to being able to become a democratically elected state, but cannot until they overcome some evil ties and beliefs that they still have.
Although Hamas as a group have committed horrible atrocities in the past, it's possible for them to operate legitimately in the future. Having been democratically elected, they have an unusual opportunity to make the transition from terrorist group to legitimate political party. If they engage with the international community openly and honestly, they should be given a chance.