I heard from a Rav that you are allowed to gamble/bet if it is not for your livelihood. How accurate is this? I heard the reason why you would not be allowed to is because it can be theft. Please provide sources if possible.
There are 2 possible reasons given for the prohibition of gambling (both of which you mentioned in your question): a poor livelihood choice (yoshvei kranot) and theft due to a lack of a true legal contract / intention to give up the funds on the part of the loser (asmachta; i.e. everyone gambles because they think they will win and don't really have in mind that they will lose with sufficient legal intent to legitimize taking their money when they do lose).
The Gemara bring down a debate about why a dice-player's activity disqualifies him:
Rami Bar Hama says that the dice player is disqualified because the wager agreement he is entering into is an example of asmachta4, because each player consents to the terms of the game only because he expects to win. Since the loser does not willingly surrender the wagered amount, the winner is considered to be stealing when he collects, and is thus ineligible as a witness or judge.5
Rabbi Sheshet says this agreement is not considered an asmachta. According to this opinion the only situations that involve asmachta are when the individual relies on his own ability. Dice players realize that the outcome of the game is determined by chance and not their own personal skill6. Rather, dice players are disqualified because they are not involved with furthering the general welfare of society.
The Talmud explains that the difference between these two opinions is the case where the gambler learned another profession.
Rami bar Hama would still disqualify the gambler by virtue of his accepting winnings based on a non-binding asmachta agreement, whereas according to Rav Sheshet he is eligible because his second occupation is socially useful.7
According to Rami bar Hama the prohibition involved in gambling is not the gambling itself but taking the winnings which involves the 'dust of robbery'.
According to Rav Sheshet there is no prohibition in taking the winnings, the problem is being a gambler. This occupation is distasteful as is non productive.
Tosaphot and the Mordechai explain that even according to the above mentioned opinion which permits "Dice Playing" as long as one has another profession, it is only permitted to do so if the actual cash is placed on the table and the money is transferred to the winner immediately follwing his victory. If, however, there is no immediate cash transaction but rather the game is based on Amanah, trust that the loser will pay, then even according to the more lenient viewpoint this is considered asmachta. There are those opinions that add that even when the cash is placed on the table, the table must be jointly owned by all players. Elsewhere18 the Mordechai further restricts the aforementioned leniency, by distinguishing between gambling that involves some form of skill and those that involve none. Only gambling that involves no skill is permitted according to this lenient opinion. The Shulhan Arukh follows the opinion of Rambam by classifying gambling as asmachta which would mean that the winner is not entitled to the proceeds of his victory and retaining would be considered stealing.22 However, like Rambam, he also only disqualifies the gambler as a witness if gambling is his only means of livelyhood,23 thereby creating the same compromise between Rab Sheshat and Rami Bar Hama as did Rambam. The Remah however disagrees with the Shulhan Arukh and decides the law according to the Tosaphot and Mordechai.