Preheat oven to 480°F (250°C). Peel and grate potatoes and onion. Squeeze grated potatoes and onions to get as much liquid out as possible. Do this at least once or twice.
Transfer grated veggies to a big bowl. Add bacon and the rest of the ingredients. Mix well until the batter is completely integrated. Generously grease a baking pan on all sides, and place it in the oven to warm up (about 2 minutes).
Carefully take the pan out of the oven, and transfer the batter into it. Use a spatula to distribute it evenly in the pan. Return to the oven.
Bake for 20 minutes, and turn the pan around about halfway. Then lower the temperature to 390°F(200°C), and bake for another 10 minutes. (Total baking time is about 30 min.)* You can lower it even more, or cover it with parchment paper.
(Optional) Take the pie out and spread butter over it. Leave it to cool down a little bit. You can break it apart with your hands, or with a knife. Additionally, mix sour cream and garlic and use it to top the pie.
Serve hash brown bacon pie as hot as you can handle it. (Some people like it colder though, so adjust to your preference.) Store at room temperature for a few hours, and transfer to the fridge in an airtight container for up to 24 hours. Discard after that time. (Kljukuša is best the same day you make it.) Reheat using your preferred method.