The Scot entered the day in a share of the lead with countryman Calum Hill and for a large part of the final round it was a head to head battle between the two home favourites.
But on a dramatic afternoon at Fairmont St Andrews, England's James Morrison carded a closing 63 to set the target at 23 under and lead by one as Forrest stood on the 17th tee.
The 28-year-old then engineered a stunning finish, putting his tee shot to four feet on the penultimate hole and making a 30 foot two putt from just off the green at the par five last to take the title by one shot after a 66.
The victory in his 77th event will move 2018 European Challenge Tour graduate Forrest into the top 200 in the Official World Golf Ranking and the top 40 on the Race to Dubai Rankings in Partnership with Rolex.
A winner of the 2010 Scottish Boys and 2012 Scottish Amateur Championship, Forrest becomes the first Scotsman to win on home soil since Paul Lawrie at the 2012 Johnnie Walker Championship at Gleneagles.
"There are so many emotions," he said. "To do it in front of everyone who has come up to support me - the last year and a half has been a real challenge on and off the course so I'm just delighted.
"We've been through quite a lot as a family and to do it here, it's what I've always dreamed of, to win on the European Tour. I think there's a big party at the in-laws tonight.
"I saw the scoreboard and I knew what I needed to do. Our big thing all day was one shot at a time, let's just keep hitting shots and I hit a great nine iron into 17 nice and close, and that really helps, and then two great shots into 18 - it was a great way to finish."
Forrest got in trouble down the left on the second to hand Hill the solo lead before both men took advantage of the par five third, and Forrest was back in a share with an approach to 14 feet at the next.
We've been through quite a lot as a family and to do it here, it's what I've always dreamed of, to win on the European Tour
Hill then made a big move, holing an 18 footer for birdie on the fifth and putting his second on the par five sixth to similar range to make an eagle.
Forrest kept the gap to two with a birdie of his own and the duo were tied at the turn as he made another with a stunning tee shot at the eighth, with Hill three putting the ninth from 12 feet.
The leader then found a bush with his second at the tenth and was forced to take a drop, surrendering a double bogey and a three shot swing as Forrest holed a 15 footer for birdie.
A brilliant tee shot to four feet at the 11th moved Forrest to 23 under but his lead was just two as the charging Law and Morrison closed in.
Law made his birdie at the sixth and then drove the par four seventh for another but really came to life after the turn, almost aceing the 11th, taking advantage of the par five 12th and sticking an approach to five feet at the next.
He was not the hottest man on the course, however, with Morrison threatening to spoil the home party.
The 36-year-old sandwiched a birdie at the sixth with a 17 footer at the first and a birdie after driving the seventh to turn in 33.
He then put his tee shot to ten feet at the 11th, made the most of the 12th, left himself a tap-in at the 13th and holed a 25 footer on the next to close the gap.
A fifth birdie in a row would come at the 15th as he put his second to six feet to get within one and Forrest had to make a gutsy up-and-down on the 14th to keep his nose in front.
Morrison had a share of the lead as Forrest three putted the 16th from 56 feet and when he made a ninth birdie of the day on the last as he got up and down from the rough with an eight footer, Forrest was left to produce his big finish.
Tarrio had a big finish of his own, making gains on the 16th and 18th to go with birdies on the third and sixth and edge ahead of Hill, who picked up a shot on the 12th in his 70, and Law, who dropped a shot on the 16th to finish with a 68.