I made a new Sprite class which inherits from sf::Sprite, but also stores a z-value (along with a few other extra things).
To order them, I used a std::list of sprite pointers and its sort function, calling a comparison function to check the sprites' z values.
I also have a std::map of the sprite pointers, indexed by std::strings, as I like being able to dynamically create sprites and refer to them with text rather than numbers. Each time the sprites are sorted, I clear the list and then re-add each sprite from the map (to ensure the list contains every sprite). I don't think this is very efficient, but I only update the order when a sprite's z is modified or a new sprite is added, and only once each frame, so it's not currently a problem. But if anyone cares to give me a better solution, go ahead.