Why does British Airways fly a short haul flight in a B767?
Aircraft selection for a particular route is quite complex, especially for a large airline that operates many different types of aircraft.  You're correct: generally speaking widebody aircraft are used for longer flights, but there are a number of other factors at play.  Some of these could be that a route has a very high peak demand, where a lot of people want to go from A->B at a given time.  LHR to Edinburgh seems particularly likely to be one of these city pairs.  Sydney to Melbourne is another one, and is only about 400 miles if my memory serves.  In both of these cases there is a dominant national airline in the mix (BA, Qantas) whereas in the USA there are almost always 3 or more large airlines operating any heavy route (New York to Boston, or Washington DC to Chicago, etc).  

Aircraft scheduling also plays a role.  For example, the 767 in question might be scheduled to fly from Heathrow to Edinburgh and back in the morning, before picking up a long-haul flight to the USA in the afternoon.  If there's a 4 hour "gap" in the schedule for that particular aircraft, it might make more sense for the airline to run it as a short out-and-back rather than have it sit on the ground at LHR.

Also, Heathrow is notoriously busy, and getting a takeoff/landing slot there is extremely expensive.  The high landing fees are charged at least partially regardless of the size of the aircraft, so there is some economic motivation here to divide those fixed costs by a larger number of passengers.

As another data point, I checked the daily schedule between Haneda (the main domestic airport in Tokyo) and Hiroshima (~400 miles away) and found the following list of flights:  9x 737, 4x 787, 2x 767, 2x 777 - so in this case you have almost half the flights on widebody aircraft, and probably closer to 75% of the total seats.

It's also entirely possible (I haven't checked the schedules) that this 767 run is temporary, due to a period of peak demand or at a point in the year where the demands on that aircraft type are lower elsewhere in the route structure.  

So in summary: it's very hard to know all the reasons that a flight might be operated with a specific type.  You need to know a fair bit about the economics of the city pair, the fleet makeup of the airlines, the likely competition for the route, how the route timing interacts with other flights, the congestion level of the airport, and a lot of other things.