If you haven't seen it, the original handwritten will for this James Foley can be found online at the Library of Virginia Archives in a Fauquier Co., Virginia, Chancery case, BRYAN T. FOLEY ADMS. of JAMES FOLEY page 2.
The LVA site also has several other chancery cases involving the estate of James Foley.
As you know, James was married twice.He listed his children by both marriages in his will. Moses Foley wasn't on the list. In addition, Moses was not mentioned in other litigation over the estate. This doesn't necessarily mean that Moses wasn't his son, but it should raise huge red flags and cause folks to look for other proof that Moses was part of this particular Foley family. Unfortunately, as far as I can tell, no one seems to have any proof of Moses' parentage. He has simply been grafted onto this family.
As to the name of James' second wife Elizabeth,there was no standardized spelling of family names in those days. In fact,most family names didn't have standardized spellings until the mid-to-late 19th century.So, Oglivie, Ogleby, Oglesby would have been perfectly acceptable spellings of Elizabeth's last name.
You also asked, "Why is Foley before Oglivie?" This is a puzzle, but it is possible that there were other Foleys with those particular first names and James wanted to make sure folks knew he was listing his children with Elizabeth.Today, he might put "Oglvie in parentheses, but I don't think those were in wide use in the 1790's.
I am actually researching the Young family.Despite family trees posted all over the internet saying that this James Foley's first wife was Mary Young, I have not found anyone who actually has proof that this was the case.