Are there any general principles of ingredient substitutions?
Yes, there are a number of things to think about, although in the end experience, intuition, and a deep understanding of the science of ingredients will be your best guide.

What does the ingredient do in the dish?

The first question to ask yourself, is what role does the ingredient play in the dish?

There are three main roles, although some ingredients can play more than one of these roles in some dishes:


Structure or backbone.  The ingredients that form the main structure or contribute to the chemistry of the dish. 

Examples would be flour in a cake, or chocolate in a ganache. 

In savory cooking, the flour used to thicken a sauce would be contributing to the chemistry.
Signature. A signature ingredient is key to the identity of a dish&mdash;it is why the dish is what it is.

Examples would include basil in a pesto recipe.
Accents and garnish. These are ingredients that compliment the flavor or texture of the dish, but aren't the core identity, or essential to its chemistry or structure.

Examples include chili flakes sprinkled on pizza, or potatoes in a stew.


Signature ingredients

If a dish is defined by a certain ingredient (such as the rum in rum balls), then substituting for the signature ingredient really isn't practical.  You would be creating a new dish, or changing what its core is.

If for dietary, religious or other reasons, you simply cannot use the signature ingredient in a dish, you would often be better served by looking to make another dish whose main ingredients you can enjoy.

On the other hand, this can be a jumping off point to invent new dish.  For example, instead of making rum balls, you might make bourbon balls&mdash;but they wouldn't be rum balls.

Structure ingredients

Substituting structure ingredients can be very simple or very tricky, depending on the application or restrictions involved.

First, ask yourself what role the ingredient plays in the recipe, and what the ingredient is principally composed of.

Some common roles are:


Fats.  Most fats can be substituted for one another fairly freely, although the flavor or texture may change slightly.

In very sensitive recipes, the water content of butter or margarine (about 20%) may be a favor.

In other recipes, the saturation of the fat, which controls whether it is solid (saturated fats) or liquid (unsaturated fats) at room temperature is important.  If the fat is used mechanically, as in biscuits or laminated pastry, you need another solid fat.  This also applies to the creaming method&mdash;the fat must be solid in order for air to be incorporated.

When used as a frying medium, for very hot frying like searing or deep frying, the smoke point of the oil may matter.  For routine sauteing it is not terribly significant as the food itself will cool the pan.
Sugars  Most sweet ingredients can be substituted for one another fairly freely, with a couple of considerations.

Liquid sweeteners like honey or syrup add water, and tend to be even more hydrophyllic than plain sugar.  Additionally, in candies and other applications where controlling sugar crystallization is important, the fact that they may inhibit crystallization can be either an advantage or a disadvantage.

One case where liquid sweeteners cannot be used is cakes or baked goods made with the creaming method, which rely on the sharp edges of the sugar crystals to cut air into the fat medium. 

Finally, some brown sugars or unrefined sugars bring a small amount of acid, which may change the acid balance of a recipe.  This is mostly important in baking, where the acid from the sweetener is used to activate chemical leavening.

Otherwise, the major issue is what flavors in addition to sweetness the ingredients carry.
Pure Starches.   Many starches have the same role in recipes, and perform similarly.

The issue to look at is if they are stable under heat or acid ingredients, and whether they gel transparently or cloudy.
Flours.   Flours are an exceptionally difficult category, especially when the flour to be substituted is wheat flour, which has special charactaristics due to gluten.   This is one area where looking at the entire recipe, and multiple ingredients is appropriate.
Acids   Many acids are used in cooking to brighten flavor.  In this case, many of them including citrus juice, various vinegars, and so on can be freely substituted to taste.

However, in baking, if the acid is meant to work with the chemical leavening, or in any curing type application, the absolute amount of acid or the pH of the recipe must be considered.
Bulk ingredients.  Bulk ingredients--often starchy vegetables or grains like potatoes, rice, barley, carrots, noodles, and so on form the body of some dishes. 

The main issue here is usually flavor balance, or texture and consistency, and how it participates in the entire dish.  For example, a stew or sauce could be served over mashed potatoes, pureed turnips, noodles, rice, or barley without changing the stew, but the overall experience would be changed.


Accent ingredients

Finally, there are accent ingredients, which do not fall into the previous categories.

These are the easiest to substitute or play with, as they don't change how the recipe works.

For example, using parsnips instead of potatoes in a stew, or garnishing cookies with chocolate sprinkles instead of coconut.

In these cases, you are looking for comparability of flavor and texture, as well as avoiding changes that would affect chemistry or structure of the dish.

So you would not substitute potatoes with tomatoes in many applications, because the tomatoes can be much more watery and more acidic, which may have an effect.

Conclusion

When deciding how to substitute, the main issue is understanding the role of an ingredient in a a dish, and finding another ingredient that can help play the same role.