Let's assume that the thief originally stole X oranges from the garden.
When the thief gave half of the oranges and two more to the first guard, he was left with (X/2 - 2) oranges.
When the thief gave half of his remaining oranges and two more to the second guard, he was left with ((X/2 - 2)/2 - 2) oranges.
When the thief gave half of his remaining oranges and two more to the third guard, he was left with (((X/2 - 2)/2 - 2)/2 - 2) oranges.
We are also given that the thief had only one orange left after giving oranges to the third guard. Therefore:
(((X/2 - 2)/2 - 2)/2 - 2) = 1
Simplifying this equation, we get:
(X/8) - 1 = 1
(X/8) = 2
X = 16
Therefore, the thief had stolen 16 oranges from the garden.