The repulsion happens after the first attack
First, let’s look at when the attacks happen. According to the Sage Advice Compendium (p. 13):
When casting a spell that affects multiple targets, such as scorching ray or eldritch blast, do I fire one ray or beam, determine the result, and fire again? Or do I have to choose all the targets before making any attack rolls?
Even though the duration of each of these spells is instantaneous, you choose the targets and resolve the attacks consecutively, not all at once. If you want, you can declare all your targets before making any attacks, but you would still roll separately for each attack (and damage, if appropriate).
This tells us that the attacks, at least, don’t happen at the same time. The SAC doesn’t say anything about Repelling Blast, so we have to look at what the feature says. The description of the Repelling Blast eldritch invocation says:
When you hit a creature with eldritch blast, you can push the creature up to 10 feet away from you in a straight line.
This doesn’t change when the attacks happen, so the attacks still happen consecutively.
The books never define “consecutive”, so we look at the dictionary definition of the word. The Merriam-Webster dictionary defines consecutive as “following one after the other in order”. So the attacks follow, one after the other.
Repelling Blast activates on a hit (see the text above), and in general, things that trigger on a hit directly follow the hit. Therefore, the second attack roll happens after the target is pushed away (following the first attack roll).
- Targets are declared. The warlock declares they want to use Repelling Blast and target the creature twice.
- The warlock makes the attack roll for the first attack. It is a hit.
- The target is pushed back 10 feet.
- The warlock makes the second attack roll.
After this point, everything continues as normal.
In the case of the ghost in front of the wall, the second attack would not hit. The ghost’s Incorporeal Movement trait says “The ghost can move through other creatures and objects as if they were difficult terrain. It takes 5 (1d10) force damage if it ends its turn inside an object”.
This feature says that the ghost can move through objects, not that it must. This leads to the question “Does the ghost even enter the wall?” The SAC says nothing about this, and I can’t find anything on this.
If the ghost does enter the wall, it is pushed back and the second attack will miss because the ghost will have cover. If the ghost does not enter the wall, the second attack could hit because the ghost would not be repelled through the wall.