PSR B1259-63 is a gamma-ray binary system composed of a high spindown pulsar and a massive star. Non-thermal emission up to TeV energies is observed near periastron passage, attributed to emission from high energy e+e- pairs accelerated at the shock with the circumstellar material from the companion star, resulting in a small-scale pulsar wind nebula. Weak gamma-ray emission was detected by the Fermi/LAT at the last periastron passage, unexpectedly followed 30 days later by a strong flare, limited to the GeV band, during which the luminosity nearly reached the spindown power of the pulsar. The origin of this GeV flare remains mysterious. We investigate whether the flare could have been caused by pairs, located in the vicinity of the pulsar, up-scattering X-ray photons from the surrounding pulsar wind nebula rather than UV stellar photons, as usually assumed. Such a model is suggested by the geometry of the interaction region at the time of the flare. We compute the gamma-ray lightcurve for this scenario, based on a simplified description of the interaction region, and compare it to the observations. The GeV lightcurve peaks well after periastron with this geometry. The pairs are inferred to have a Lorentz factor ~500. They also produce an MeV flare with a luminosity ~1e34 erg/s prior to periastron passage. A significant drawback is the very high energy density of target photons required for efficient GeV emission. We propose to associate the GeV-emitting pairs with the Maxwellian expected at shock locations corresponding to high pulsar latitudes, while the rest of the non-thermal emission arises from pairs accelerated in the equatorial region of the pulsar wind termination shock.