The method is gruesome. They probably intend it mainly as a deterrent.
I agree, especially since it seems to be an "official" method of a capital punishment, and not just some mob of people inflicting "justice". Do they have some specially appointed people who throw stones? Bizzare.
particularly for something that shouldn't be a criminal offense
From what I could gather she was accused in being somehow involved in the death of her husband (and those lovers were the killers). That is the reason for such a cruel punishment, apparently.

PS. From what I've heard Iran is one of the freeest countries in its region, especially in the area of women rights (judging by large number of women who are University graduates and have prestigious jobs, like doctors, and some other facts). At least it's the image I had of this country from media coverage.