The electrification question needs better phrasing. Are we talking about recognisably "mainline" applications or any form of electric traction?
Brighton's Volks Railway might well be the first UK electric railway, but the first to use standard gauge electric traction was the City & South London Railway (later to form part of the Northern line) in Dec 1890, closely followed by the Liverpool Overhead Railway in Feb 1893. However, these can be viewed as a purely "Metro" system as they have no links with the mainline network.
The first mainline electrification was the NER's Tyneside Electrics network in 1904. The LB&SCR were a distant 3rd with their London Bridge to Victoria via Denmark Hill line (Dec 1909), tailing the Midland Railway's Lancaster to Morcambe and Heysham route (Apr 1908 ) by 20 months.
**EDIT**
Not sure I would class a shunter as a "mainline service". Even so, the closest I can get is LMS 1831, which was an ultimately unsuccessful experimental diesel shunter rebuilt from an 0-6-0 steam engine in 1931. The next oldest mainline loco is BR Class D16/1 10000 which appeared in Nov 1947.
However, both GWR and LMS experimented with diesel railcars from 1933 onwards.
The LMS purchased three 95hp 4-wheeled railcars from Leyland in 1933 which were trialled on the Preston to Carlisle route before seeing service on the Blackburn to Springvale and Clitheroe routes. There was also another diesel-electric railcar that operated between London and Castle Bromwich for two weeks during 1933 in connection with an industry fair. (The LMS later ordered a 3 car streamlined articulated set from the Derby works, which was delivered in 1939. This saw use on the Cambridge to Oxford route and then the St Pancras to Nottingham route before beng withdrawn at the outbreak of WW2. After the war it was converted to a 2 car formation as an OLE maintenance train and continued in this form until the late 1950's. With 750hp on tap in a unit weighing 73 tons in total, it must have been one hell of a flyer in it's original form.)
The GWR produced it's prototype diesel railcar in 1934, gradually adding to it's fleet during the 1930's and early 1940's.
O L Leigh