There is no publicly available information that implies that Trump predicted a Gillespie loss before the actual election, and it appears that he only distanced himself from Gillespie after the VA Governor election.
The tweet by Donald Trump was picked up by a number of news sources, including by Business Insider, The Chicago Sun-Times, Newsweek, and Politico, among others. None of the news sources have provided evidence of Trump publicly indicating that he believed Gillespie would lose. Some sources even call into question the truth to the statement.
In Gillespie's case, Trump did not express doubt about the Virginia Republican's candidacy until after his Election Day defeat.
(...) if he predicted a GOP loss in Virginia, it was in private.
Factbase maintains a list of tweets made by Pres. Trump and allows you to search tweets made by the President. There are no tweets prior to the Virginia gubernatorial election in 2017 that are critical of Gillespie.
Propublica maintains a list of tweets that were deleted by Donald Trump and only one tweet mentions Gillespie.
RT @realDonaldTrump: .@EdWGillespie will totally turn around the high crime and poor economic performance of VA. MS-13 and crime will be gone. Vote today, ASAP!