Doesn't Paul imply that an individual goes directly to heaven at death by stating that he "desires to depart and be with Christ" and "death is gain" (Phil. 1:21, 23)?

The Bible does not contradict itself. Paul doesn't state one thing in one place and another someplace else. The apostle is clear. At the Second Coming of Jesus, the righteous dead are resurrected to receive their eternal reward (1 Thess. 4:16, 17, 1 Cor. 15:51-54). In Phil. 3:20,21 the apostle points out that "our citizenship is in heaven from whence also we look for the Savior the Lord Jesus Christ who shall change our vile body that it might be fashioned like His glorious body."

Again his desire is the Second Coming of our Lord. Writing to his friend, Timothy, the apostle declares from this same Roman prison, "I have fought a good fight, I have finished my course, I have kept the faith. Henceforth there is laid up for me a crown of righteousness which the Lord, the righteous judge, shall give me at that day: and not to me only, but unto all them also that love His appearing" (2 Tim. 4:7, 8). Paul longed for the return of Jesus when he would see his Lord face to face and be ushered into eternity.

Yes, death is gain! For the apostle it meant freedom from the pain of a weary body, deliverance from the bondage of a Roman prison, and security from the temptation of Satan. To Paul, death was a sleep with no passage of time. The next event after closing his eyes in the sleep of death was "to depart and be with Christ." Since there is no conscious passage of time from death to the Second Coming, for Paul, death meant closing his eyes in sleep and waking up to be with his Lord.