Loud Knock starting out of nowhere, Please Help, need advice
So i was driving home from my parents house last friday and it was a really hot day(about 100 out) i stopped at the gas station filled about half way up and when i pulled out and up to the first light my cel started flashing. pulled out the code reader and pulled the codes p0301 and p0172. so i continued driving home after clearing the codes to see if they would come back on, they did not. As i was getting home i heard a faint ticking noise that would come and go. i didnt think much of it since these engines are pretty loud already. as i got home i was downshifting to turn down the street and out of no where a knocking noise started. i coasted down the street and shut off the car just to make sure i didnt damage it. started checking it out(i am a mechanic so i have some idea of what im doing) and it had a knocking noise coming from under the throttle body. put it in the garage and did a compression check on cylinder 1 and 3. found 75 psi in cylinder 1 and 125 in #3. did a wet compression check on cylinder 1 and it went up to 120.
Also there seemed to be dirty water or oil in the intercooler tubing as well as around the turbo. the air filter is pretty dirty but unsure if it caused the problem. the last thing i noticed was a little bit of oil dripping from around the turbo. havnt investigated it yet but will probably do so if i have to replace the engine.
That is where i am at right now, i am fearing the worst that it will need a new engine but i am hoping someone can at least give some usful advice as what to check to confirm exactly what it is. Im not very firmiliar with these engine. anything will help, thank you.
2002 Subaru wrx 2.0 all stock except hks bov and intake in fender. clutch and flywheel replaced 5 months ago, a month after i bought the car.