Include file order in sketches

After three agonizing days trying to figure out why my sketch compiled with no errors but did bizarre things, I found that

#include <I2CMiniTerminal.h> // .c library from smileymicros.com
#include <Wire.h>

works fine, but

#include <Wire.h>
#include <I2CMiniTerminal.h> // .c library from smileymicros.com

does not.

Are there rules for this? Are there things I need to look for in library headers or source which cause the order dependency?

What did the error message say when things were the wrong way round ?

...R

There were no error messages. Everything compiled and linked fine. The sketch simply behaved bizarrely as though there were a buffer overflow or a race problem but nothing I could pin down in two days of inserting debugging code except that it related to the I2C somehow. It never hung up, and my event loop continued to run, detect button presses and display things on an LCD, but just not right.