2018 Update: Keys are worth 34.44-34.55 refined metal as of now, so gaining profits from crates is very difficult. On top of that, way too many hats are worth less than 3 refined, so most random hat crafting will not be worth it. the same can be said for crafting two craft hats together, as those same hats are worth less than the 2.66 refined metal required to buy the craft hats.
In conclusion, and a guess for the future: It is not worth it to try and use RNG to make profits. There is too much that can go wrong. And, it will likely stay like this until the end of time. There are some windows where the risks can yield much better profits, such as if a set of craftable items come out or if a new series of crate or cases comes out (but this window is small (AND if the window ever opens again)).
Very Out-Dated Information Below
The only reason you would want to un-crate for profit is for unusuals,
salvaged crates, and the special holiday crates. All ususuals are worth more than a key, so are most (probably all) salvaged crate stranges. The holiday crate items don't start with a high price, but they usualy skyrocket after a few months. Look at festives. If you want specific items from crates, it is better to sell the keys for metal, or trade the keys directly for the items you want.
It all depends on what you are looking for. If you want profit, uncrating is not the way to go. If you want to excperience the thrill of luck, then uncrating is right for you. But, most of the time, profit is not gained from uncrating (unless Gaben is on your side).
Random crafting though, can be much more profitable than uncrating. If you buy two 1 ref hats, and craft them and get a Double Cross Comm (super rare hat), you can resell for a massive profit. But, there are low chances to get these "rare" hats, so it is not too easy to make profit. BUT, if you time it right as a new hat comes out, you can craft for an attempt at a craft # item. The values of these are very odd, ranging from 1-3 keys to 1-3 Buds, depending on the number and the hat.
The same as above applies to random weapon crafts, but random weapon crafts is much more profitable, becuase there are less total weapons. You just get a Class Token (for a class that has a rare weapon), a Slot Token (matching the same slot as the rare weapon), and a scrap, and craft them together. Some rare weapons are worth 1.33-2 ref, depending on the weapon and how new it is. The craft # bit also applies here.
Edits based on recent economy shifts:
Unless you only count the first #30 Slavaged Crate, it is not worth it to unbox Slavaged Crates most of the time. The values of the (salvaged) crates exceed the value of most of the items in it (excluding the rarest drops out of them). You can make profit from unboxing though, if you unbox at the right time. If you happen to have some tradable keys when a new crate type comes out, find a tradable crate, then unbox it, you could make profit. But, with the "wait a week to trade items recently purchased thing," this method takes lots of patience and time. Also, you would have to find someone who wants to buy the item for lots of money early, and does not want to wait. Once 1-2 weeks have pasted, the values of the items from the new crate(s) will have decreased.
The profit from Festives is also dying. With more and more people wanting to try and make massive profit from re-selling festives once an event is over, the prices of Strange Festives are dropping. 2014's Strange Festives are falling through the floor, and I will assume that 2015's will be even worse (in price).
AND, with the rising price of keys (and the dropping prices of everything else), trading your keys for metal/the items you want would be the right way to go. Unless my source is wrong, keys are currently at 18 ref and climbing.
In conclusion: you are better off selling your Keys for either the metal to buy the thing you want or trading the Key directly for it. The chance for making profit from unboxing is way too low, and the profits earned from crafting weapons is also too little for the risk involved.