edge: An edge is an expectation caused by noticing that repeated trials of a certain bet causes excess value over risk taken. Notice that edge is defined only in the sense of a repeatable process, and that it is a "probabilistic" notion.
investing: To invest means that you are purchasing a future cash flow. If it is done well, it is done at a reasonable price. Warren Buffet is the penultimate investor. By it's very nature, investing tends to be done over at least a dividend cycle, but most would say that is much too short a time frame and investing is usually meant in at least six month to one year or more. Cash flow can be dividends, or raising share price, etc.
speculating: To speculate is to risk money in anticipation of profit, over repeated trials, usually over a short time frame. Note the distinction that speculating is some sort of averaging process that takes risk and some (at least one) probability distribution into consideration, where the act of speculating hopefully creates value in the form of taking on risk that produces value above and beyond that risk, i.e., speculating doesn't assume an edge, but it is good to have one when speculating.
gambling: Is the act of speculating on a specific instance, where the averaging effect of repeated trials is not brought into effect. So, even if you have an edge, if you only try the event once, it is considered gambling and not speculating because you are not allowing the averaging effect (repeated trials) to wield it's power.