The much-travelled Tykes striker, at his eighth club, converted a second-half penalty after Nathan Doyle had scored his first senior goal to give Barnsley a fourth-minute lead.
Although Lewis McGugan raised Forest hopes of a comeback with a fine solo effort with 22 minutes remaining, substitute Jacob Butterfield struck a late third for Barnsley, who are the first side to beat Forest since their 1-0 defeat at Burnley on the opening day of the season.
Barnsley's fourth home league win of the season lifted them into the top half of the table, while Billy Davies' Forest, who had drawn six of their first 10 league games 1-1 prior to kick-off, drop into the bottom half.
Gray, Doyle and Goran Lovre all returned to Barnsley's starting line-up, while Forest's only change saw Dele Adebola up front alongside Dexter Blackstock as Nathan Tyson succumbed to a knee injury.
Barnsley raced into a fourth-minute lead in their first attack. A sweeping move saw winger Adam Hammill cut the ball back from the byline and Doyle coolly despatched a right-footed shot into the bottom corner from 12 yards.
Forest responded with a wayward 30-yard shot from defender Wes Morgan, but neither side carved out another clear-cut chance until Chris Cohen's 25-yard effort whistled past home goalkeeper Luke Steele's post in the 33rd minute.
Barnsley midfielder Lovre began to pull the strings for the home side as half-time approached and Hugo Colace went close to extending the Tykes' lead with a rasping shot that cleared the crossbar.
Blackstock went closest to hauling Forest level in the first half when his left-footed shot was blocked by Tykes skipper Stephen Foster in stoppage time.
Steele denied the visitors four minutes after the restart, punching clear McGugan's free-kick and then expertly holding on to Cohen's curling ball into the box.
McGugan then dragged his shot wide from the edge of the penalty area, but it was Barnsley who struck again to double their advantage in the 56th minute.
Blackstock was adjudged to have brought down Lovre in the area and Gray stepped forward to plant the ball right-footed beyond Forest goalkeeper Lee Camp.
Forest defender Cohen blocked Foster's goalbound header from Jay McEveley's corner, but Forest served warning that they were not out of the contest when David McGoldrick's angled drive slammed against the upright.
McGugan then reduced the visitors' deficit with his fifth goal in the last six games, creating space for himself 20 yards out before firing a low shot into the bottom corner in the 68th minute.
McGoldrick was off target with another long-range effort soon after and Cohen headed Paul McKenna's cross just over as Forest chased an equaliser.
But Barnsley made sure of the spoils when Butterfield, an 80th-minute replacement for Lovre, planted a left-footed finish into the bottom corner from 18 yards after latching on to Hammill's ball across the penalty area.
There was still time for Blackstock to force another flying save from Steele with a stinging 20-yard shot, but the points were already safe for Mark Robins' side.