Attached Link: http://www.equilibrium.com/products/deBabelizer/index.jsp

In Photoshop 6 (not sure about other versions) when you "Save For Web" and select "Gif" as the format, you are given the ability to sort sort the colour table via a drop arrow. You should check out "Debabelizer" for all yor advanced palette needs. There is a demo availibele (link attached)