If someone is trying to pray 40 consecutive days at the Kotel, does beginning prayer one minute after sunset count for the day that's ending? For the day that's starting? Both? Neither?
As the question you linked to states, this is a recent custom and essentially it depends on why you are doing 40 days at the Kotel.
If you made a vow, then it would depend on what you had in mind. If you didn't think about this trick then it would go by how most people would interpret it. Most people assume (as far as I know) that 40 days at the Kotel mean you have to make the effort to go 40 consecutive days to the Kotel.
This is called: בִּנְדָרִים הַלֵּךְ אַחַר לְשׁוֹן בְּנֵי אָדָם
But even if you had in mind to simply pray 40 consecutive days at the Kotel, with on 20 trips, you probably can't do it right before & after sunset.
I have been taught that the Yerushalmim consider the first 13 minutes after sunset as day (and in a pinch you can Daven Mincha then).
18 minutes after sunset you can already daven Maariv without repeating Shma. I assume the 5 minutes between are Bein Hashmashot - twilight.
So if you want to do 40 days at the Kotel in 20 days, you probably need to pray for a few moments before sunset (or within the 13 minutes thereafter in emergency), and then again 18 minutes after sunset.