I'm sure this is enough time to do it even though the two airports are on opposite sides of London a long way apart. You could go to the Waterstone's at Trafalgar Square and I suggest that because it's a big one, and you can get there by Piccadilly line Underground from Heathrow to Piccadilly Circus, change to the Bakerloo line Southbound and it's one stop to Charing Cross. (We all call it the tube.)
But keep an eye on the clock and then go for lunch. 2 stops north on the Northern line from Charing Cross to Tottenham Court Road, Central line east to Liverpool Street, and there is an Honest Burger a short walk from there https://www.honestburgers.co.uk/locations/liverpool-st/ Eat and take the Stansted Express train from Liverpool Street - takes about an hour. I'm not suggesting taxis because London traffic then can be ruddy awful so I would "tube it".
Work out the timings first (the TfL Journey Planner will help) and plan your book browsing accordingly! Assuming you're coming from the USA or Canada, you could feel incredibly jet-lagged on arrival at Heathrow as 7:40 am there is 2.40 am Eastern Time, so you will want to sleep on the flight if you possibly can. See how zonked you feel on arrival and if you don't, there's a plan.
Being tall I can never even snooze in an economy seat so whenever I get home from "across the pond", getting home by bus afterwards (I live a few miles north of Heathrow) feels like an unreal experience. I immediately collapse into bed and sleep through the day, usually waking up in early afternoon.
Getting out of Heathrow isn't fast either. The line of bleary-eyed Americans at Heathrow at breakfast time has to be seen to be believed because so many flights go overnight, and I would bank on at least an hour to get through immigration and Customs. Of course as a British citizen I get to completely bypass it so I've never been through it.
So there's my idea of a plan, but be prepared to totally abandon it and just get yourself to Stansted.
Edit - thumbers down, explain why, or don't you have the courage of your convictions?