What a BEAUTIFUL piece of code this is...
It also works in sub-cats - so if you make a sub-category with only 1 product, your customer does not have to visit the subcategory page first...
This is especially useful if you are using a nested category menu, such as
PhilJ's "True Three Level Vertical Category Flyout Menu"
This code along with the flyout menus makes the interface fluid and what you (read: customer) expect.
Very, very nice.