It sounds like the guy wanted to make a sale. Do you know if the shop had a 15"? I would go back to the shop and try a 15" to see how that feels. If you like the feel, perhaps the manager would be able to make it right for you. If they offer no recourse or don't have the 15", is it possible to go to a different bike shop to try the smaller size? You may need to sell the 17.5" in order to get the right bike for you.
That said, your bike shop may be able to make adjustments to fit you to the current bike. I'm 5'4" and ride a 17" Giant mountain bike. I know my bike can handle a taller rider but I love the way it fits me. I haven't ridden a Specialized mountain bike so I comment on their sizing.
Please don't feel too bad about what happened. I had a very similar experience when I bought my road bike. I was lucky in that my mistake didn't cost me too much. (I did have to sell my "uncomfortable" road bike myself.) I have now learned the value of finding a great bike shop so lesson learned. I really hope you can make some minor adjustments to make you comfortable riding the bike.