Shimano steel freehubs are compatible with 8-, 9- and 10-speed cassettes, so that shouldn't be a problem.

The reason for that is that the cogs are different widths. So a 10-speed cassette requires a 10-speed chain and a 10-speed shifter. I'm not 100% sure whether chainrings are also different widths.

When you swap your cassettes, you may have to adjust the B-tension screw on your RD to keep the jockey wheel from contacting the 27T cog. (I did when I made the same swap.) Shimano has service and adjustment instructions for all their components on their website.