Question: Would the Lord forgive the sins of a person who was not yet saved if he asked for forgiveness for particular sins?
Answer: Thank you for a very interesting question! To answer it effectively, I'll have to split humanity up into its two most important categories: the saved and the unsaved—but then, split that saved category into two-subcategories: the saved and the pre-saved, and I believe that pre-saved most accurately describes the person in your question. But let's deal with the unsaved first. By unsaved, I mean any persons who are not now saved nor will ever be saved.
We must remember that God, in his omniscience, knows all things at the same instant, but we do not. We are stuck playing-out our lives out in linear time. God interfaces with us in our linear existence, of course, but he views it (primarily) from outside of time. As such, he knows which persons will exercise their free will unto salvation and those who will not. Those who will not are categorically unrighteous, and God will not hear their petitions—whether for favors or for selective forgiveness.
“We know that God does not listen to sinners, but if anyone is a worshiper of God and does his will, God listens to him.” (John 9:31, ESV).
“but your iniquities have made a separation between you and your God, and your sins have hidden his face from you so that he does not hear.” (Isaiah 59:2, ESV)
“For the eyes of the Lord are on the righteous, and his ears are open to their prayer. But the face of the Lord is against those who do evil.” (1 Peter 3:12, ESV).
Forgiveness requires dialogue, and a non-believer cannot have one with God because he is dead in his sins (Eph. 2:5), and a dead person cannot act! By way of contrast, "all you who fear God" will find in him a most eager listener.
“Come and hear, all you who fear God, and I will tell what he has done for my soul. I cried to him with my mouth, and high praise was on my tongue. If I had cherished iniquity in my heart, the Lord would not have listened. But truly God has listened; he has attended to the voice of my prayer. Blessed be God, because he has not rejected my prayer or removed his steadfast love from me!” (Psalm 66:16–20, ESV)
The Psalm 66 verse is instructive for both the saved and the unsaved, so let us now turn our attention to saved individuals. Because of the difference between our absolute immersion in linear time and God's view from outside of it, the technical moment of salvation comes into debate. Was it at a sinner's first petitions? At some specific moment in a prayer? At the cross? Before the foundations of the earth? All are possible since God exists outside of time. But before I proceed I must issue a disclaimer. It is my personal opinion that the Bible has no slam-dunk answer to this question. As such, I shall speculate using scriptural inference—but please be cautious: These speculations should never be turned into dogma. They are just one man's opinion. That being said, here's my spin.
God set the plan of redemption before the foundations of the world (1 Pet. 1:18-21). I therefore ask, for whom did he set it? After all, there were not yet any sinners. Did God have no specific targets for redemption? Was it just a program for whomever would eventually needed it? Or did he target just Adam and then let the whole process run automatically? Or did he target individuals like you and me? I believe the latter, and I base this upon Ephesians 1:4.
“even as he chose us in him before the foundation of the world, that we should be holy and blameless before him. In love” (Eph. 1:4, ESV).
The Bible shows us two other aspects of his forgiveness that also support my preference. First, when we are saved (in real time), we are forgiven retro-actively (an event which determines an outside-of-time change).
“Repent therefore, and turn back, that your sins may be blotted out,” (Acts 3:19, ESV).
The image of blotting out refers to a piece of writing which was already on the page, but one which was no longer valid. In an era before the "delete" key, such an emendation could only be performed by blotting—covering over with ink to hide the original. By way of figure, this evokes a sin that was already there (and is therefore a fact of history) but has been covered so as not to be considered. All of our sins—present, future and the past—are blotted out at out moment of salvation. As such, salvation that we perceive as happening at a moment-in-time actuates processes that occur outside of time's concurrent flow. Since this "violates" a linear time restriction, it makes sense to place the moment of forgiveness outside of a believer's linear earthly life. I place it back with the institution of redemption.
Secondly, there is the sealing.
“And do not grieve the Holy Spirit of God, by whom you were sealed for the day of redemption.”
(Ephesians 4:30, ESV).
Although this verse does not tell just when the sealing occurred, the process is tied to the day of redemption, and I therefore place this sealing activity also before the foundations of the earth. When we seal something, we seal its entirety. Think of placing all of your important documents in an envelope, addressing it to heaven, and then sealing the flap. The documents may be old or new, but they're all inside, and they're all going to the same place.
In summation, God performs his redemptive acts both outside and inside of time, but he runs its overarching processes outside of time's restrictions while we participate in our normal volitional lives within those time restrictions. Once we are born-again into his family we inherit the family jewels: An eternal redemption, replete with positional sanctification—a scenario wherein it does not matter when we accessed all the advantages of eternity because we now participate in it...and time does not matter. Let me close with this verse.
“And without faith it is impossible to please him, for whoever would draw near to God must believe that he exists and that he rewards those who seek him.” (Hebrews 11:6, ESV).
In your question you posited a seeker who had enough faith to approach God in earnest about his sin. Faith is the price of admission into the Kingdom of God. Although this person would not be technically saved as we would perceive salvation at a moment in time, such a person is pre-saved, and is therefore (in my opinion) categorically saved—and categorically able to dialogue with God.
I pray that all this data helped more than it hurt. I was very glad to find someone who was so interested in spitting the Bible's hairs. God bless you!