The Czech from Team NetApp beat the 27-year-old in the sprint to the line but the Endura rider takes the gold leader's jersey from Leigh Howard who was dropped as the field tackled the category one climb of Caerphilly Mountain twice at the end of the 189.6km stage.
Tiernan-Locke, who has won three stage races already this season, attacked at the foot of the climb with 14km remaining and crossed the summit just ahead of the last member of the day's escape group Graham Briggs (Raleigh).
Briggs was dropped on the second ascent as Koenig bridged the gap to the Tiernan-Locke, sitting on his wheel for most of the fast 5km descent back into Caerphilly before making his decisive move.
But Tiernan-Locke still gained six bonus seconds and is now in a strong position to add the British title to his Tour Méditerranéen, Tour du Haut Var and Tour Alsace victories with two stages remaining.
He leads Howard by 13 seconds with another Australian Nathan Haas (Garmin - Sharp) a further five seconds back after winning the 11-man sprint for third, 18 seconds behind Koenig.
It was Marcin Bialoblocki (Node4), Dan Craven (IG Sigma), Kristian House (Rapha Condor), Pieter Ghyllebert (AnPost), Magnus Backstedt (UK Youth) and Briggs who formed a break soon after the start at Powis Castle in Welshpool and built up a maximum lead of eight minutes.
The Orica GreenEDGE team of Howard and Tiernan-Locke's Endura squad led the chasing peloton and reduced the deficit to 4:50 after the first climb of Cwm Owen.
But their advantage was down to only 45 seconds as they hit Caerphilly Mountain and they were soon caught as the stage exploded.
Bradley Wiggins did not start the stage due to a stomach bug.