Bam Margera is working out again as part of his latest rehab program ... and one of his oldest friends says it's the best Bam has been in ages.
Bam's "Jackass" and "Viva La Bam" costar, Brandon Novak, tells TMZ ... it's the closest Bam has been to the person he was when they were growing up together on the skateboard scene.
Bam's working out at Recovery Through Repetition, a fitness gym for folks who are in recovery, and Brandon says they took Bam to his first class Friday night and the plan is to get Bam exercising on a consistent basis.
TMZ broke the story ... Bam said one of his earlier rehab stints made him feel like he was going to die from an overdose or suicide, and he claimed he was seeking help in Florida.
Bam got booted from the latest 'Jackass' movie because he failed a drug test ... but he sued and last week a settlement was reached.
Now it sounds like Bam is getting back on the right track.