Referees typically use significant time and effort to provide their expert views on manuscripts in the review process. It is therefore never a bad idea to thank them. That said, there are a few things to keep in mind.
First, keep in mind that your revisions, based on their comments and the editor's handling is what the reader's see. It would not be fair to make it seem as if the resulting article is all due to the reviewers comments. In fact, they may end up disagreeing with some points of your final article.
Second, a bad type of behaviour is to acknowledge reviewers in a way that does not reflect their statement. I know of a case where an well respected peer was mentioned as having provided "valuable input on an earlier version of the manuscript" where the review was a "reject" of a really poor manuscript. In this case it was made to look as if the current manuscript was endorsed by the peer, which really was not the case. [to add a further explanation: one can promote ones own work by implying that someone who is a major name has provided input earlier and by doing so have provided input to the state of the manuscript under review]
So, thanking reviewers is a good way to provide acknowledgement to persons who support the process but remember to phrase it so as not to put aspects of the final paper in their mouth that they do not support.