Okay, so I have a tool that can currently write none remapping dune2 shp files, which is enough to edit the TD/RA mouse cursors, but I've not yet tackled generating the lookup table I think is needed for remap.
I've looked over the code for the Red Horizon and think I know where it goes wrong though, it builds the table in the order it encounters a colour, so if the first pixel it encounters is not 0, that gets position 0 in the lookup. However I believe the game always treats 0 as transparent, it never checks the lookup for it and so 0 must always map to 0 in the lookup or you get this error.
Not that this info helps you right now, but it means I should get it right when I do it ;)