My take:
Everything that happened up until the last shot counts.
If B1 was off the court, then stepped on at the last minute to catch the pass, that's the time to issue the T for "leaving the court for an unauthorized reason." Wave off the shot, put 1.7 seconds back on the clock, give A two shots and the ball. OH -- and since that would be B1's fifth foul, he can leave the court now.
IF B1 was on the court during the whole throw-in process (there wasn't any attempt to decieve), then count the bucket.