(TL;DR version: there are a lot of things that need to happen for an NFL team to steal him away at this point, and there isn't enough time for all of those things to happen.)
Based on everything that has been reported and rumored, there are four things of which we can be reasonably certain: 1) Hackett is in the Bay Area as we speak to try to seal the deal, 2) whatever understanding has been reached involves some type of agreement by the 49ers to release Harbaugh from his contract, 3) there is a meeting scheduled between Harbaugh and Hackett at some point after the 49ers' final game today, and 4) as of last night, Harbaugh was sure enough that he wanted to come to Michigan that he gave his close friend Dave Feldman the go-ahead to report the news.
Neither Michigan nor the 49ers want Harbaugh to go to another NFL team, which is why the 49ers would probably only release Harbaugh from his contract if he agrees to take the Michigan job (or at the very least, agrees not to pursue a position with another NFL team). Hackett has probably spoken with the 49ers' brass about extricating Harbaugh from his contract and may have some kind of understanding in place by which Michigan covers all or part of Harbaugh's buyout (or, if there isn't a buyout, pays the 49ers some kind of consideration) on the condition that the 49ers refrain from trying to trade his rights to another NFL team. Thus, I think the meeting scheduled for after the game involves Hackett, Harbaugh (and his agent), AND 49ers representatives.
At that meeting, the written contracts that consummate this three-way understanding will be executed. It's in the interests of both Michigan and the 49ers to hold the meeting as soon as possible after the game ends, preferably before Harbaugh leaves the stadium and ideally immediately after he's done addressing his team and meeting with the media (which is why yesterday's report that Michigan is sending a "crew" to the 49ers game makes sense). Today is game day, and knowing how laser-focused and competitive Harbaugh is, his mind is on the game and only the game.
So, the only way that this could fall through and we lose Harbaugh to the Raiders or another NFL team is if 1) Harbaugh gets cold feet between the end of the game and the meeting, 2) he meets with his agent during that short window and tells him to delay the meeting, 3) his agent delays the meeting, 4) his agent immediately gets on the phone with other teams and is able to come to an agreement with one of them, 5) his agent somehow gets the 49ers to give the other team permission to interview Harbaugh, 6) the team satisfies its Rooney rule obligations, 7) the team and the 49ers agree to a trade, and 8) Hackett and everyone who has lobbied Harbaugh over the past few weeks is unable to sway him back. Keep in mind that if 1, 2, and 3 happen, Hackett will probably give Harbaugh a hard deadline of no more than two days to say yes or no, and that 4, 5, 6, 7, and 8 would all need to happen before that deadline. The likelihood of that is extremely small.
In short, I think we can rest assured that this is done.