I checked James II in my own database, he had four sons: James and Alexander (twins), David, and John. And, following up on one of the sources I used (The Scots Peerage) I discovered James II did have one illegitimate son, but his name was John
Stewart of Sticks and Ballechin, ancestor of the
Stewarts of Ballechin in Perthshire [SP 1, p. 20]. None of the sources I used on him (Complete Peerage, Scots Peerage, AR7, Burke's Peerage, et al.) showed he had an additional son, Thomas Cash--sorry.
Then, there were numerous
Stewarts named James--I have 31 James
Stewarts in my own database who stem from several of the
Stewart branches including the
Royal Stewarts. So the possibility exists he was descended from a James
Stewart, just not James II. Another facet of this puzzle is that hereditary surnames were not an absolute rule in
Scotland at the time and their could have been many reasons for the father and son not having the same surname. Aside from illegitimacy, it was not unheard of for one to change his surname as part of an agreement in order to inherit lands and or titles from in-laws, distant relatives, etc. Then, there were even instances where many had taken the name
Stewart who were not related to any of the main
Stewart branches, some having actually served a
Stewart family and taken the surname of their patron. So just trying to figure this out from the evidence offered allows for many different possibilities. I'd suggest taking the information obtained from Ancestry.com and find proofs the each preceding generation was in fact the correct one. Then follow back as far as you're able to insure the line is correct or to find the correct lineage--whichever is the case.
Jim