(AP) - The NBA and the players' union reached an agreement Wednesday after an all-night bargaining session to save what's left of the season, The Associated Press has learned. The deal was struck between commissioner David Stern and union head Billy Hunter. The agreement comes just hours before a key players' meeting and one day before the NBA's threatened deadline for a settlement. It was not immediately clear how many games would be played or when the season would begin. On Tuesday night, Stern had said chances of a settlement were better than 50-50. "On a scale of one to 10, I'd make it a five-plus," Stern said on CNN. The league's Board of Governors had scheduled a meeting for Thursday, and Stern and deputy commissioner Russ Granik had said they would recommend canceling the rest of the season if no agreement had been reached. NBA players had begun arriving in New York for a vote on whether to support the position of their negotiating committee, which had recommended that the owners' final offer be rejected. At least 200 players had been expected to show up for the vote. NBA players have the highest average salary in professional sports, about $2.6 million annually, and the median salary is about $1.3 million. The union had wanted higher salaries for the so-called lower and middle-class players. The league wanted a $12.25 million maximum salary for players with at least 10 years' experience, while the union wanted $15 million. The owners' final offer was presented to the union by Stern in Denver 1 1/2 weeks ago. It is believed that a season of 45 to 50 games could begin no earlier than the first week of February.Buy your holiday gifts